]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: Disable DAX flow control
authorRob Gardner <rob.gardner@oracle.com>
Wed, 19 Apr 2017 17:21:13 +0000 (11:21 -0600)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 May 2017 16:50:49 +0000 (09:50 -0700)
Orabug: 25997202

The flow control feature of DAX only works for output buffers
and it doesn't appear to be possible to calculate the exact
size in bytes of an input buffer. So we have no way to bound
the amount of data that DAX reads as input. This has correctness
and security implications, so until we figure out something better
to do, the temporary workaround is to disable flow control completely
and fall back to 4Mb virtual page backed dax_alloc memory, which
will allow page boundaries to limit the size of all buffers.  A new
module parameter "flow_enable" is provided to allow this decision
to be reverted at module load time if needed.

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Reviewed-by: Jonathan Helman <jonathan.helman@oracle.com>
Reviewed-by: Sanath Kumar <sanath.s.kumar@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/dax/dax_main.c
arch/sparc/dax/dax_mm.c

index 87c345dffdf8713a9fee79b8d1f71aaa6bc83d52..078ea1ce92653f24580b6635a187d8e9c5795184 100644 (file)
@@ -50,6 +50,9 @@ module_param(force, int, 0644);
 MODULE_PARM_DESC(force, "Forces module loading if no device present");
 module_param(dax_debug, int, 0644);
 MODULE_PARM_DESC(dax_debug, "Debug flags");
+static int flow_enable = 0;
+module_param(flow_enable, int, 0644);
+MODULE_PARM_DESC(flow_enable, "Enables flow control if hardware supports it");
 
 static const struct file_operations dax_fops = {
        .owner =    THIS_MODULE,
@@ -163,8 +166,11 @@ static int __init dax_attach(void)
         * MD does not report it in old versions of HV, we need to explicitly
         * check for flow control feature.
         */
-       if ((dax_type == DAX1) && !dax_has_flow_ctl_numa()) {
-               dax_dbg("Flow control disabled, dax_alloc restricted to 4M");
+       if (!flow_enable) {
+               dax_dbg("Flow control disabled by software, dax_alloc restricted to 4M");
+               dax_no_flow_ctl = true;
+       } else if ((dax_type == DAX1) && !dax_has_flow_ctl_numa()) {
+               dax_dbg("Flow control disabled by hardware, dax_alloc restricted to 4M");
                dax_no_flow_ctl = true;
        } else {
                dax_dbg("Flow control enabled");
index 480c07b949cca8197599630529c95b6d35afcbb0..890e2c4d8e52352d8574fd62d181c2f646a75afc 100644 (file)
@@ -249,11 +249,7 @@ void dax_map_segment(struct dax_ctx *dax_ctx, union ccb *ccb, size_t ccb_len)
                }
 
                if (hdr->at_src0 == CCB_AT_VA_ALT) {
-                       access = (struct ccb_data_acc_ctl *)
-                                 &ccbp->dwords[QUERY_DWORD_DAC];
-                       /* size in bytes */
-                       size = DAX_IN_SIZE_FROM_CCB(access->input_cnt);
-                       if (dax_map_segment_common(size, &ccb_addr_type, "src0",
+                       if (dax_map_segment_common(0, &ccb_addr_type, "src0",
                                                QUERY_DWORD_INPUT, ccbp,
                                                dax_ctx) == 0)
                                hdr->at_src0 = ccb_addr_type;