Commit 74a85247 authored by SeongJae Park's avatar SeongJae Park Committed by Boris Ostrovsky

xen-blkfront: add a parameter for disabling of persistent grants

Persistent grants feature provides high scalability.  On some small
systems, however, it could incur data copy overheads[1] and thus it is
required to be disabled.  It can be disabled from blkback side using a
module parameter, 'feature_persistent'.  But, it is impossible from
blkfront side.  For the reason, this commit adds a blkfront module
parameter for disabling of the feature.

[1] https://wiki.xen.org/wiki/Xen_4.3_Block_Protocol_ScalabilitySigned-off-by: default avatarSeongJae Park <sjpark@amazon.de>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Acked-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
Link: https://lore.kernel.org/r/20200923061841.20531-3-sjpark@amazon.comSigned-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
parent aac8a70d
...@@ -8,3 +8,12 @@ Description: ...@@ -8,3 +8,12 @@ Description:
is 32 - higher value means more potential throughput but more is 32 - higher value means more potential throughput but more
memory usage. The backend picks the minimum of the frontend memory usage. The backend picks the minimum of the frontend
and its default backend value. and its default backend value.
What: /sys/module/xen_blkfront/parameters/feature_persistent
Date: September 2020
KernelVersion: 5.10
Contact: SeongJae Park <sjpark@amazon.de>
Description:
Whether to enable the persistent grants feature or not. Note
that this option only takes effect on newly created frontends.
The default is Y (enable).
...@@ -1866,8 +1866,8 @@ static int talk_to_blkback(struct xenbus_device *dev, ...@@ -1866,8 +1866,8 @@ static int talk_to_blkback(struct xenbus_device *dev,
message = "writing protocol"; message = "writing protocol";
goto abort_transaction; goto abort_transaction;
} }
err = xenbus_printf(xbt, dev->nodename, err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u",
"feature-persistent", "%u", 1); info->feature_persistent);
if (err) if (err)
dev_warn(&dev->dev, dev_warn(&dev->dev,
"writing persistent grants feature to xenbus"); "writing persistent grants feature to xenbus");
...@@ -1941,6 +1941,13 @@ static int negotiate_mq(struct blkfront_info *info) ...@@ -1941,6 +1941,13 @@ static int negotiate_mq(struct blkfront_info *info)
} }
return 0; return 0;
} }
/* Enable the persistent grants feature. */
static bool feature_persistent = true;
module_param(feature_persistent, bool, 0644);
MODULE_PARM_DESC(feature_persistent,
"Enables the persistent grants feature");
/** /**
* Entry point to this code when a new device is created. Allocate the basic * Entry point to this code when a new device is created. Allocate the basic
* structures and the ring buffer for communication with the backend, and * structures and the ring buffer for communication with the backend, and
...@@ -2007,6 +2014,8 @@ static int blkfront_probe(struct xenbus_device *dev, ...@@ -2007,6 +2014,8 @@ static int blkfront_probe(struct xenbus_device *dev,
info->vdevice = vdevice; info->vdevice = vdevice;
info->connected = BLKIF_STATE_DISCONNECTED; info->connected = BLKIF_STATE_DISCONNECTED;
info->feature_persistent = feature_persistent;
/* Front end dir is a number, which is used as the id. */ /* Front end dir is a number, which is used as the id. */
info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0); info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
dev_set_drvdata(&dev->dev, info); dev_set_drvdata(&dev->dev, info);
...@@ -2316,9 +2325,10 @@ static void blkfront_gather_backend_features(struct blkfront_info *info) ...@@ -2316,9 +2325,10 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0))
blkfront_setup_discard(info); blkfront_setup_discard(info);
info->feature_persistent = if (info->feature_persistent)
!!xenbus_read_unsigned(info->xbdev->otherend, info->feature_persistent =
"feature-persistent", 0); !!xenbus_read_unsigned(info->xbdev->otherend,
"feature-persistent", 0);
indirect_segments = xenbus_read_unsigned(info->xbdev->otherend, indirect_segments = xenbus_read_unsigned(info->xbdev->otherend,
"feature-max-indirect-segments", 0); "feature-max-indirect-segments", 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment