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 61FDFCCA473 for ; Wed, 1 Jun 2022 17:57:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244093AbiFAR5C (ORCPT ); Wed, 1 Jun 2022 13:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356532AbiFAR46 (ORCPT ); Wed, 1 Jun 2022 13:56:58 -0400 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 914E36574; Wed, 1 Jun 2022 10:56:49 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id E68A830002502; Wed, 1 Jun 2022 19:56:47 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id DB547350DAF; Wed, 1 Jun 2022 19:56:47 +0200 (CEST) Date: Wed, 1 Jun 2022 19:56:47 +0200 From: Lukas Wunner To: Ira Weiny Cc: Jonathan Cameron , Dan Williams , Bjorn Helgaas , Christoph Hellwig , Alison Schofield , Vishal Verma , Ben Widawsky , linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH V8 03/10] PCI: Create PCI library functions in support of DOE mailboxes. Message-ID: <20220601175647.GA21509@wunner.de> References: <20220414203237.2198665-1-ira.weiny@intel.com> <20220414203237.2198665-4-ira.weiny@intel.com> <20220530190657.GA14765@wunner.de> <20220531113350.0000421e@Huawei.com> <20220601071808.GA19924@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Wed, Jun 01, 2022 at 10:16:15AM -0700, Ira Weiny wrote: > On Wed, Jun 01, 2022 at 09:18:08AM +0200, Lukas Wunner wrote: > > You only need to re-check the Data Object Ready bit on the last-but-one > > dword in case the function was reset concurrently. Per sec. 6.30.2, > > "An FLR to a Function must result in the aborting of any DOE transfer > > in progress." > > I think I disagree. Even if we do that and an FLR comes before the last read > the last read could be 0's. PCIe r6.0, Table 7-316 says: "If there is no additional data object ready for transfer, the DOE instance must clear this bit after the entire data object has been transferred, as indicated by software writing to the DOE Read Data Mailbox Register after reading the final DW of the data object." Remember that you *read* a dword from the mailbox and then acknowledge reception to the mailbox by *writing* a dword to the mailbox. So you check that the Data Object Ready bit is set before acknowledging the final dword with a register write. That's race-free. (I realize me talking about the "last-but-one dword" above was quite unclear, sorry about that.) Thanks, Lukas