Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5816926ioo; Wed, 1 Jun 2022 13:12:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYTvUYUHFgqX3n9ts5OQpjKd8LnwYWtgR7BOjKFMwR36RC2TpW5TWv2p7dO6LKOlK/Tv2d X-Received: by 2002:a17:902:d54b:b0:164:bf9:3e1e with SMTP id z11-20020a170902d54b00b001640bf93e1emr1193449plf.58.1654114356550; Wed, 01 Jun 2022 13:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654114356; cv=none; d=google.com; s=arc-20160816; b=xlHriqqPW+FD1rN6maBPBVSlKeLas/wH6oBY01LehbX85uW/D71fnZzjlZlatp/uUF VsRLjvc4IpsR8udo9hrJc7MHnr3S+bEv1q3q7tDJwtmLWyyAewHp9yz3EMwv6FwR5ZH9 SG+mx1vPcHOnUbOvm5kWoi7kBhhFkd/vflN5qwDwaEtS1I05D9iy34+42QUF/R+KxPLv qb+cTyV3ez8O+2uINopXq9JgWHFsgukyqfVrsldSR7AvJdqA/X6nJ334BPVNbV2pqgIv 1+P056R+AYciMNYEGUmBWdkVwF6jHSNaKXE2qN6YBE1FnnlJik42/ck+Kv7bcdnXWLuk 5InQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SALSdUkhUFQKmclxT8Nfs8zUdajzmJ/r+tsgTtsVySc=; b=yN47cm/aIvTWM4laxwtGLBwJqBzeO+HMbzvSRJoxffgHYWD0Ddhgsh3g3u9HCZr3+L Tw4CZvo4ZkgnHGzGTJiUXrBTuE84vxtre1Og04rPdmNgPJXpDQ4lMq0ApvU6dND/Jsud 2fE5flFt8bf3IF1LyuCqUToTfc4Wgh/rvC+FNWdlg3w37SrATHvbdwNKWXjehvjcuayY kXPoHl8622w3DE396TzKiPMxoIij2anfoBBnozzTZH3Md7An5UdEqRyCvxdLMf1/Owpj 6pyHHyKoy29frtiavZJHy4UxgdbIevJhWDZiLbicLukh0XENfeOQkZtnJTYvQoYVckaQ xKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FiRQhHIe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x17-20020a170902821100b001619ccff412si3396687pln.410.2022.06.01.13.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:12:36 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FiRQhHIe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CDDAF234685; Wed, 1 Jun 2022 12:26:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353988AbiFAQzn (ORCPT + 99 others); Wed, 1 Jun 2022 12:55:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351331AbiFAQzm (ORCPT ); Wed, 1 Jun 2022 12:55:42 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EFF79E9E0; Wed, 1 Jun 2022 09:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654102542; x=1685638542; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=73mc9UeFg58ka932G9d5Vhn6ii7yZChtzbk6FVFDixA=; b=FiRQhHIe7y4rkj4KBb8VCynHNDzTipwleFNqCpVfpKEgPGE1exw894NX TMYfXQ4zKWLpvPEHUgv98SKJJIx25v+7VKi4BDgE/c5DxVQeqRcXZPqYK 5DqyTzPiviaxgB2l/uS6mVe21fvuJjtN1CmTRavoldv7mW4lPsxiBFUuP TSzSNTKkUaOvLbsPNrS/80w6Gcb8shLbGjXiqiZIPGgcFoHhCIdIvh4pZ sYneSxW290LvqgLung0E64GzBL6j8ldPx6f9lAZCe7DfVQYuTF4+Cy6nO occajMI46O5naEOgDeoOyEWLpT3LoxtGsm/VNQbGWe1o82UQ3WpMN8o39 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10365"; a="275733973" X-IronPort-AV: E=Sophos;i="5.91,268,1647327600"; d="scan'208";a="275733973" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2022 09:55:38 -0700 X-IronPort-AV: E=Sophos;i="5.91,268,1647327600"; d="scan'208";a="552399086" Received: from cwmurphy-mobl2.amr.corp.intel.com (HELO localhost) ([10.212.32.23]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2022 09:55:37 -0700 Date: Wed, 1 Jun 2022 09:55:37 -0700 From: Ira Weiny To: Davidlohr Bueso Cc: Dan Williams , Bjorn Helgaas , Jonathan Cameron , Alison Schofield , Vishal Verma , Dave Jiang , Ben Widawsky , linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org, a.manzanares@samsung.com Subject: Re: [PATCH v9 3/9] PCI: Create PCI library functions in support of DOE mailboxes. Message-ID: References: <20220531152632.1397976-1-ira.weiny@intel.com> <20220531152632.1397976-4-ira.weiny@intel.com> <20220531172507.5ert5tgwellpe7fx@offworld> <20220531175652.qog7xaqmypy36whu@offworld> <20220601135909.mvnam4vvfmofpsdb@offworld> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220601135909.mvnam4vvfmofpsdb@offworld> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Wed, Jun 01, 2022 at 06:59:09AM -0700, Davidlohr Bueso wrote: > On Tue, 31 May 2022, Ira Weiny wrote: > > Thinking about it I don't see a benefit to a rwlock. We don't have multiple > > readers. > > ... but you have concurrent workqueues reading the value of cur_task. No, concurrent workqueues are reading the value of different DOE mailboxes' cur_task. Each mailbox has it's own lock for its current task. This is a multiple writers to a single reader pattern. The lock serializes driver requests (possibly from different threads) into the single mailbox as well as signaling when the cur_task is done; retire_cur_task(). At the same time multiple mailboxes can be running parallel. I don't think taking the lock in doe_statemachine_work() is technically necessary. But I left it there for completeness because if the queue depth is increased like it was in Jonathans original code the locking around cur_task will need to be adjusted in this area. Ira > > Thanks, > Davidlohr