Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp735645rwe; Wed, 31 Aug 2022 10:04:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR4DxjfioZhpp+GYBg26c0CMGJJCPsSeqR05k4ACZ46EafvsFoXujy/vpOT3/FSPXCtpwXSz X-Received: by 2002:a17:907:d0c:b0:741:6115:a69 with SMTP id gn12-20020a1709070d0c00b0074161150a69mr12907986ejc.325.1661965463415; Wed, 31 Aug 2022 10:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661965463; cv=none; d=google.com; s=arc-20160816; b=07wo1nGZgYysUB5jzec3mxdmK57223LCqdNp7Gkz04vKIT3ccNExZACEDjPJqgqm+m ZBdxrzchuHmAYd8wTKDzsBhpi+3yZVoT7xCl+AZvUsucJF43jAgwihGQDZVNEcL/ul5u ElS/QRJM5C8EQMPyi2m3XgSRPxW5vcmuEh9CIreOqWU+EuLx81Mk/W1d33pwolDPtC0F dxI03l3NRJ7pytR/wKadrg0P6puuHp/zQRCP2oQoAvo3hjdPwhAc534Z1HNsRqiNhEtl v/3j8cEtV/Y+6j+yDdyDVTJXzHMTw7ZUGlO5nshHbP3nC/f18W05KRUErFzEN9Tuhssj NJXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z2+IGLOpSO6K8qyo9HP8AwNK8BBJgR6HN3jCRBRQEnE=; b=akh5s9lypgDoIYi+c/XZGq9xSgoJ2sZ8xerXPZDsKlNYsaHIMjbR7ebaYsvtkVdT7I 3GQaxQMvmMY+1i00Vcz/OPZg0P6MXzXP7ZFfKIUy93rdadHALpV3/Tmfb5enEVlTTR4v fbvgnIHs8Fp4XW44l2YNvjV0k+ylCoaaYdmw+45xhL2/gSlKDvJRF9IC9VkF6uitqjpT AEKdUR0A8RCBFlEiykDPo1/ZF4lL/ac1iJRnlHr7YAISOVmMDDvBlh+cMa1v2Tj57ATd uL9miFakK9GpdJJAXFPdE+7KXToYLHkPs85lAfnE1fJGtbscrma1klRE00ft6gyF2DV8 mQ0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r+yj2nUL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y70-20020a50bb4c000000b00445e930ef86si10677749ede.468.2022.08.31.10.03.54; Wed, 31 Aug 2022 10:04:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r+yj2nUL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232422AbiHaRAB (ORCPT + 99 others); Wed, 31 Aug 2022 13:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232167AbiHaQ7j (ORCPT ); Wed, 31 Aug 2022 12:59:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC3F9E01C8; Wed, 31 Aug 2022 09:58:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E5C2B82207; Wed, 31 Aug 2022 16:58:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22B88C433C1; Wed, 31 Aug 2022 16:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661965112; bh=2M6XIQVeSqrPrYytDvGmk8JSZnX1cUCppYJ4t0zteug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+yj2nUL8cBvYHbhNGByKXHfolByjrFRe687uj1BUUB6mIbeXN2akLAiQRdvStbqP NMb5qiC+ThAz7uY10jHDz33BEKstZU2iTWJpSn0pPMwG29otA0+v7b4oevDXX9xywt daiS3FmM4D7SFz4ZS2QhL+z/hmZONNOucXCZH3i5gYjg1q8QBAYtaXJ65YwQKdQzb0 vUEOeCFozOnzBRrMkAQ5iuwNZdviUg+Q7J75Jt4uuZwxML8bP5XUh9fA3KShUEsq9Y 3L8j6pjOgw50j/r6rdnjpE4dC/uRqcRZVpRbxbOCphVbmdYWOEHGFNP8VkJoa9oNlQ OeAJ+c6yTMvqA== From: SeongJae Park To: jgross@suse.com, roger.pau@citrix.com Cc: SeongJae Park , marmarek@invisiblethingslab.com, mheyne@amazon.de, xen-devel@lists.xenproject.org, axboe@kernel.dk, ptyadav@amazon.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 1/3] xen-blkback: Advertise feature-persistent as user requested Date: Wed, 31 Aug 2022 16:58:22 +0000 Message-Id: <20220831165824.94815-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220831165824.94815-1-sj@kernel.org> References: <20220831165824.94815-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The advertisement of the persistent grants feature (writing 'feature-persistent' to xenbus) should mean not the decision for using the feature but only the availability of the feature. However, commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") made a field of blkback, which was a place for saving only the negotiation result, to be used for yet another purpose: caching of the 'feature_persistent' parameter value. As a result, the advertisement, which should follow only the parameter value, becomes inconsistent. This commit fixes the misuse of the semantic by making blkback saves the parameter value in a separate place and advertises the support based on only the saved value. Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") Cc: # 5.10.x Suggested-by: Juergen Gross Signed-off-by: SeongJae Park --- drivers/block/xen-blkback/common.h | 3 +++ drivers/block/xen-blkback/xenbus.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index bda5c815e441..a28473470e66 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -226,6 +226,9 @@ struct xen_vbd { sector_t size; unsigned int flush_support:1; unsigned int discard_secure:1; + /* Connect-time cached feature_persistent parameter value */ + unsigned int feature_gnt_persistent_parm:1; + /* Persistent grants feature negotiation result */ unsigned int feature_gnt_persistent:1; unsigned int overflow_max_grants:1; }; diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index ee7ad2fb432d..c0227dfa4688 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -907,7 +907,7 @@ static void connect(struct backend_info *be) xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", - be->blkif->vbd.feature_gnt_persistent); + be->blkif->vbd.feature_gnt_persistent_parm); if (err) { xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", dev->nodename); @@ -1085,7 +1085,9 @@ static int connect_ring(struct backend_info *be) return -ENOSYS; } - blkif->vbd.feature_gnt_persistent = feature_persistent && + blkif->vbd.feature_gnt_persistent_parm = feature_persistent; + blkif->vbd.feature_gnt_persistent = + blkif->vbd.feature_gnt_persistent_parm && xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); blkif->vbd.overflow_max_grants = 0; -- 2.25.1