Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3969126pxk; Tue, 22 Sep 2020 07:18:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxfVjs0w0pkx+oTpF4qA27mky949HwXhXccZ69iDqlBvT4ZrvF9vCxTeTvUL+hmIr56ieo X-Received: by 2002:a05:6402:13d3:: with SMTP id a19mr3986121edx.255.1600784310592; Tue, 22 Sep 2020 07:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600784310; cv=none; d=google.com; s=arc-20160816; b=TtTQZy6+Xy2UIINkviSaQVLlqmEOguFPI+l285XHH3DClra3Yd2h8UUptxifRJ+DcO JBFpWOVt2nlXV2+g2K3xuGmhYVXgGv60ndHAzwltsJZFvtizlbgMq+HhY7gB6MFV21QK pFojNkFZXYWFj5wrHs+QP2Btq2SP5XARZQec1on3NmX2NpJLG9lhLp+ge9iFtnASzc3S 415WFtUOjWe0cv/t1QG+GkH1HqFRp/TGhYBIrg59jfXtf/3MLObomO//wDq3HEIxSoPD 7gMenlSIqhw7NrVPLCZEB38Se/M1PBW1O9UybjlRbspMfQ6HjPteX8kITy/wj+BvJBS9 ucxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=I6FWFRPKOvHgCEvGqE3sI6rE2eUEbK6ToJxGZZYg2sI=; b=bzp/QuANZH8Sa6mg3fYbW2Dv/27o3oZOjC30aekI7usclDk1VWpMt1GdGIstyTt1H2 Q26slyQmuz1DvkFBmXDtKSQFNBetozlMt9CPMhIds0ZKLA2SJddDu3E0niAizt0umQ6B 9ibu8StGtQvPHD8CozsXBgkgj83lhVklDwuZqn906LR/ZDc4YGzCvY4Vw8Q4fyoY5frD LRqqUsp3V+wtW/LYnrj6AVj+r5SSzTcd796W88XY1RvRw8rcIuRHYEdw9XrQY4Tq2gOT bOpAF4zLE9a92fCnBcWfwOROjag/knNrRuODacVlmOhde5cfg3GK3SIAHaZPBLY76t2B RPPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=tSGRoKdz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j14si10526054edy.412.2020.09.22.07.18.06; Tue, 22 Sep 2020 07:18:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=tSGRoKdz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbgIVOQa (ORCPT + 99 others); Tue, 22 Sep 2020 10:16:30 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:25964 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbgIVOQa (ORCPT ); Tue, 22 Sep 2020 10:16:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1600784189; x=1632320189; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=I6FWFRPKOvHgCEvGqE3sI6rE2eUEbK6ToJxGZZYg2sI=; b=tSGRoKdzq48Eus/u0ZmdM2tk8rKJO20CgKd1MNUbvtlNPyRKMCWWP0ZV XViq0aPnnE50DKlMs6iRZg5crJGqTgyggyOmI7Q+DzBKLb1XR4NyEGXYI /hjZlqQ45sr3EnSqvDWmL0dbQOqnBIg6tNS3avD3bUnoReqzrJxREMfRS A=; X-IronPort-AV: E=Sophos;i="5.77,291,1596499200"; d="scan'208";a="55537286" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-c300ac87.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 22 Sep 2020 14:16:26 +0000 Received: from EX13D31EUA004.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2b-c300ac87.us-west-2.amazon.com (Postfix) with ESMTPS id B6EBFA1800; Tue, 22 Sep 2020 14:16:25 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.160.137) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Sep 2020 14:16:19 +0000 From: SeongJae Park To: , , CC: SeongJae Park , , , , , , , , Subject: [PATCH v3 2/3] xen-blkfront: add a parameter for disabling of persistent grants Date: Tue, 22 Sep 2020 16:15:48 +0200 Message-ID: <20200922141549.26154-3-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200922141549.26154-1-sjpark@amazon.com> References: <20200922141549.26154-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.137] X-ClientProxiedBy: EX13D12UWC001.ant.amazon.com (10.43.162.78) To EX13D31EUA004.ant.amazon.com (10.43.165.161) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: SeongJae Park 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_Scalability Signed-off-by: SeongJae Park --- .../ABI/testing/sysfs-driver-xen-blkfront | 9 +++++++++ drivers/block/xen-blkfront.c | 20 ++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-xen-blkfront b/Documentation/ABI/testing/sysfs-driver-xen-blkfront index c0a6cb7eb314..9c31334cb2e6 100644 --- a/Documentation/ABI/testing/sysfs-driver-xen-blkfront +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkfront @@ -8,3 +8,12 @@ Description: is 32 - higher value means more potential throughput but more memory usage. The backend picks the minimum of the frontend and its default backend value. + +What: /sys/module/xen_blkfront/parameters/feature_persistent +Date: September 2020 +KernelVersion: 5.10 +Contact: SeongJae Park +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). diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 91de2e0755ae..b2d3b1262404 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -1866,8 +1866,8 @@ static int talk_to_blkback(struct xenbus_device *dev, message = "writing protocol"; goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, - "feature-persistent", "%u", 1); + err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", + info->feature_persistent); if (err) dev_warn(&dev->dev, "writing persistent grants feature to xenbus"); @@ -1941,6 +1941,13 @@ static int negotiate_mq(struct blkfront_info *info) } 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 * structures and the ring buffer for communication with the backend, and @@ -2007,6 +2014,8 @@ static int blkfront_probe(struct xenbus_device *dev, info->vdevice = vdevice; info->connected = BLKIF_STATE_DISCONNECTED; + info->feature_persistent = feature_persistent ? 1 : 0; + /* Front end dir is a number, which is used as the id. */ info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0); dev_set_drvdata(&dev->dev, 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)) blkfront_setup_discard(info); - info->feature_persistent = - !!xenbus_read_unsigned(info->xbdev->otherend, - "feature-persistent", 0); + if (info->feature_persistent) + info->feature_persistent = + !!xenbus_read_unsigned(info->xbdev->otherend, + "feature-persistent", 0); indirect_segments = xenbus_read_unsigned(info->xbdev->otherend, "feature-max-indirect-segments", 0); -- 2.17.1