Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6152185rwb; Tue, 22 Nov 2022 09:22:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf5tkDKibsZj0yuKWssVGV0eDSlqrc6kxdQLc4FwL5gnZygkLUt3rtfu2L1L8rE+A22/FBUt X-Received: by 2002:a63:c143:0:b0:45b:f8be:7400 with SMTP id p3-20020a63c143000000b0045bf8be7400mr4393741pgi.30.1669137779083; Tue, 22 Nov 2022 09:22:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669137779; cv=none; d=google.com; s=arc-20160816; b=bsIhcqzeAlj7KYv6zgynR1UYQJVmYRyzeCIyxmslPFiQ9Pt0Ck5a+oyyOnG27YW//6 ntSX1EhnUUamA/GoSE4PwM4FiJVx5xZ3H95lQbJoY0yt9Kgr/XsNXZY0FErTSrufyW7t HbWrMhSQJ5fscRGMig6lhbwYYlgRlPROH8QWP7MzrzK7Lz0dWNSWMkxlM6lvpcKx+AoF wm9xOFy1VP5hZpZUYBoW/USO59GAkkGA7RnYfISY4lIssAJL23/huioROQXgMo5wuBOu vf3bd4RfsjfZrBsvUBlJagAYo9T5+gDh/A1n0tBXApy1NyAmG8hUaZDIXoEB364t2wMt E9gA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=XfsF7hxd2KYmDzHbkjIhTZQ2zcD147uyzonn8iSghm8=; b=RjoQpnO4jqkzeZ8y5CABVcwtu20RYcK2JRqRX11009AkmM5+t5pb7JiToMCz56K/Ba RjfsbaZURGdCwhL0g2666f9W2x5uxCnB1JqHZ+hetRn36Mv/eJtCgpXcSfkRASc+LwJ0 6in5I7VepRcyOyMWPAXsCt14uGrZASHgQvRsM6nvsdnPPxkEJAYw7BoES/iOR+GAKwaK N0nzWrh0PIsu30TrCvF8ExJdm+8LwXCOKh/WoT5a21l2UXYFCgS2x2EWsDG+lRq0fMLx 5gVAzhRa45tX9PCNh3oPhZg1nb812ZjrO+lioHcyI3uHZhipHGgRYBCh6myG8QXpQJD9 mYmA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m32-20020a634c60000000b0046f3dfb97a5si5892428pgl.660.2022.11.22.09.22.45; Tue, 22 Nov 2022 09:22:59 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234143AbiKVQnM (ORCPT + 90 others); Tue, 22 Nov 2022 11:43:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234291AbiKVQnI (ORCPT ); Tue, 22 Nov 2022 11:43:08 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD65445ED8; Tue, 22 Nov 2022 08:43:05 -0800 (PST) Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NGqkQ2BJyz67NJj; Wed, 23 Nov 2022 00:40:30 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 17:43:03 +0100 Received: from localhost (10.45.149.88) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 16:43:02 +0000 Date: Tue, 22 Nov 2022 16:43:01 +0000 From: Jonathan Cameron To: CC: Dan Williams , Bjorn Helgaas , Gregory Price , "Li, Ming" , Lukas Wunner , Alison Schofield , Vishal Verma , , , Subject: Re: [PATCH V2 2/2] PCI/DOE: Remove asynchronous task support Message-ID: <20221122164301.00002346@Huawei.com> In-Reply-To: <20221122155324.1878416-3-ira.weiny@intel.com> References: <20221122155324.1878416-1-ira.weiny@intel.com> <20221122155324.1878416-3-ira.weiny@intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.45.149.88] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 On Tue, 22 Nov 2022 07:53:24 -0800 ira.weiny@intel.com wrote: > From: Ira Weiny > > Gregory Price and Jonathan Cameron reported a bug within > pci_doe_submit_task().[1] The issue was that work item initialization > needs to be done with either INIT_WORK_ONSTACK() or INIT_WORK() > depending on how the work item is allocated. > > Initially, it was anticipated that DOE tasks were going to need to be > submitted asynchronously and the code was designed thusly. Many > alternatives were discussed to fix the work initialization issue.[2] > > However, all current users submit tasks synchronously and this has > therefore become an unneeded maintenance burden. Remove the extra > maintenance burden by replacing asynchronous task submission with > a synchronous wait function.[3] > > [1] https://lore.kernel.org/linux-cxl/20221014151045.24781-1-Jonathan.Cameron@huawei.com/T/#m88a7f50dcce52f30c8bf5c3dcc06fa9843b54a2d > [2] https://lore.kernel.org/linux-cxl/Y3kSDQDur+IUDs2O@iweiny-mobl/T/#m0f057773d9c75432fcfcc54a2604483fe82abe92 > [3] https://lore.kernel.org/linux-cxl/Y3kSDQDur+IUDs2O@iweiny-mobl/T/#m32d3f9b208ef7486bc148d94a326b26b2d3e69ff > > Reported-by: Gregory Price > Reported-by: Jonathan Cameron > Suggested-by: Dan Williams > Suggested-by: "Li, Ming" > Signed-off-by: Ira Weiny > Hi Ira, A few things inline. Jonathan > diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c > index 260313e9052e..41c7bf5794a5 100644 > --- a/drivers/pci/doe.c > +++ b/drivers/pci/doe.c > @@ -18,7 +18,6 @@ > #include > #include > #include > -#include > > #define PCI_DOE_PROTOCOL_DISCOVERY 0 > > @@ -39,7 +38,7 @@ > * @cap_offset: Capability offset > * @prots: Array of protocols supported (encoded as long values) > * @wq: Wait queue for work item > - * @work_queue: Queue of pci_doe_work items > + * @lock: Lock state of doe_mb during task processing > * @flags: Bit array of PCI_DOE_FLAG_* flags > */ > struct pci_doe_mb { > @@ -48,7 +47,7 @@ struct pci_doe_mb { > struct xarray prots; > > wait_queue_head_t wq; > - struct workqueue_struct *work_queue; > + struct mutex lock; > unsigned long flags; > }; > > @@ -198,7 +197,6 @@ static int pci_doe_recv_resp(struct pci_doe_mb *doe_mb, struct pci_doe_task *tas > static void signal_task_complete(struct pci_doe_task *task, int rv) Given this doesn't signal anything any more, perhaps rename the function, or just push the task->rv = ... inline.? > { > task->rv = rv; > - task->complete(task); > } ... > diff --git a/include/linux/pci-doe.h b/include/linux/pci-doe.h > index ed9b4df792b8..c94122a66221 100644 > --- a/include/linux/pci-doe.h > +++ b/include/linux/pci-doe.h > @@ -30,8 +30,6 @@ struct pci_doe_mb; > * @response_pl_sz: Size of the response payload (bytes) > * @rv: Return value. Length of received response or error (bytes) > * @complete: Called when task is complete complete is gone as well. > - * @private: Private data for the consumer > - * @work: Used internally by the mailbox > * @doe_mb: Used internally by the mailbox > * > * The payload sizes and rv are specified in bytes with the following > @@ -50,11 +48,6 @@ struct pci_doe_task { > u32 *response_pl; > size_t response_pl_sz; > int rv; > - void (*complete)(struct pci_doe_task *task); > - void *private; > - > - /* No need for the user to initialize these fields */ > - struct work_struct work; > struct pci_doe_mb *doe_mb; > }; ...