Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1262839lfc; Wed, 1 Jun 2022 13:28:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzGwuPxiC3rWkXsW1LjdDdvcyHd1++MEEt/h2qGwzn24RAHScm++ay69eBp8sp3V88tLsw X-Received: by 2002:a65:6854:0:b0:3fc:d602:3cf8 with SMTP id q20-20020a656854000000b003fcd6023cf8mr434564pgt.176.1654115324557; Wed, 01 Jun 2022 13:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654115324; cv=none; d=google.com; s=arc-20160816; b=p85FfUTa6d6KxGP0tmEqUNTc2EM9qUkId8un7Bm/ZmErTeNrg+io1NMcaF8oNTSoOZ IWft7lx9iKyYaoMJk7Ha5IFViAktYOCNJp8Ym6OeJx+Gl76Or+jVdrTt7/4LjRvfYEye tqCNyj3ZdMdANxfqqyTTWCIbYThk74gjLnU2ZOgxtxCreE/8yJvkL/hddJpr3bgG1zVr 0xxdQtqbY/Q7mw0HD1450YnQKtkzN+Fj58nsWxHV3iJrufApXmJkF8NqBhGCAN2jyKFQ XMxWxTNI11xLOAI8WW4DO00QkKCOhRYpwqSwWkvdpAre5NlKdcAxIm3R6b3GP0CKAn1H yNNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Xe3YldLlXxPsY99t6vBrB168XbQml94gcmqGLq06F10=; b=gVqE0EDKsZA+q7Nz0eXTIUe3LInbayjRZ6EC3uDkpiEehx6EiqkKNj3l1LR0pdh4Gx ew5/oeN9l2HMrK6SUQFL19k9ULUm1Qqe5tarnCPO2AQ+xl3Nkd+UY+i5eE8g5I2rsCuX poYFSlBy106kicHJHZBfKQ6SHu/scvvVAW6NpUMsvcDjmus4sZxKIkwMnCsc3YNe97R2 OQ+dcyzkWSFlaVaKWQSKeHO1l0LJLF1sH99UbLAjg1yqkPsUBWPDQgZ14T0yjvD+vEv+ GipFzNdDjZRby/ArJYEEjug7FdmSxk3go9Yyj9wiFDA51OgHylLuMLiUj4Q+v9rknDDh HPqA== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b5-20020a170902bd4500b00163ee364721si3288918plx.465.2022.06.01.13.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:28:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D59641E7140; Wed, 1 Jun 2022 12:43:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356477AbiFAR5D (ORCPT + 99 others); Wed, 1 Jun 2022 13:57:03 -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) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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