From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC350C61DA4 for ; Tue, 14 Feb 2023 11:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbjBNLgT (ORCPT ); Tue, 14 Feb 2023 06:36:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbjBNLgS (ORCPT ); Tue, 14 Feb 2023 06:36:18 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4EA021280; Tue, 14 Feb 2023 03:36:17 -0800 (PST) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4PGJyg4xcVz6J9gG; Tue, 14 Feb 2023 19:34:35 +0800 (CST) Received: from localhost (10.202.227.76) 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.2507.17; Tue, 14 Feb 2023 11:36:15 +0000 Date: Tue, 14 Feb 2023 11:36:14 +0000 From: Jonathan Cameron To: Lukas Wunner CC: Bjorn Helgaas , , "Gregory Price" , Ira Weiny , "Dan Williams" , Alison Schofield , Vishal Verma , Dave Jiang , "Li, Ming" , "Hillf Danton" , Ben Widawsky , , Subject: Re: [PATCH v3 10/16] PCI/DOE: Deduplicate mailbox flushing Message-ID: <20230214113614.00006ec9@Huawei.com> In-Reply-To: <7b5cf1e007ba1638ff2512f221e8a7fd72ed8245.1676043318.git.lukas@wunner.de> References: <7b5cf1e007ba1638ff2512f221e8a7fd72ed8245.1676043318.git.lukas@wunner.de> 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.202.227.76] X-ClientProxiedBy: lhrpeml500003.china.huawei.com (7.191.162.67) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org On Fri, 10 Feb 2023 21:25:10 +0100 Lukas Wunner wrote: > When a DOE mailbox is torn down, its workqueue is flushed once in > pci_doe_flush_mb() through a call to flush_workqueue() and subsequently > flushed once more in pci_doe_destroy_workqueue() through a call to > destroy_workqueue(). > > Deduplicate by dropping flush_workqueue() from pci_doe_flush_mb(). > > Rename pci_doe_flush_mb() to pci_doe_cancel_tasks() to more aptly > describe what it now does. > > Tested-by: Ira Weiny > Signed-off-by: Lukas Wunner LGTM Reviewed-by: Jonathan Cameron > --- > Changes v2 -> v3: > * Newly added patch in v3 > > drivers/pci/doe.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c > index afb53bc1b4aa..291cd7a46a39 100644 > --- a/drivers/pci/doe.c > +++ b/drivers/pci/doe.c > @@ -429,7 +429,7 @@ static void pci_doe_destroy_workqueue(void *mb) > destroy_workqueue(doe_mb->work_queue); > } > > -static void pci_doe_flush_mb(void *mb) > +static void pci_doe_cancel_tasks(void *mb) > { > struct pci_doe_mb *doe_mb = mb; > > @@ -439,9 +439,6 @@ static void pci_doe_flush_mb(void *mb) > /* Cancel an in progress work item, if necessary */ > set_bit(PCI_DOE_FLAG_CANCEL, &doe_mb->flags); > wake_up(&doe_mb->wq); > - > - /* Flush all work items */ > - flush_workqueue(doe_mb->work_queue); > } > > /** > @@ -498,9 +495,9 @@ struct pci_doe_mb *pcim_doe_create_mb(struct pci_dev *pdev, u16 cap_offset) > > /* > * The state machine and the mailbox should be in sync now; > - * Set up mailbox flush prior to using the mailbox to query protocols. > + * Set up cancel tasks prior to using the mailbox to query protocols. > */ > - rc = devm_add_action_or_reset(dev, pci_doe_flush_mb, doe_mb); > + rc = devm_add_action_or_reset(dev, pci_doe_cancel_tasks, doe_mb); > if (rc) > return ERR_PTR(rc); >