Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2986642pxb; Mon, 4 Apr 2022 05:04:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvm9TR783EbS8UUYLUscapCPCYF24N3LpjWfeQ2YsuI076BDcObA0rd/ee7ABFZytJxXgP X-Received: by 2002:a05:6402:34c9:b0:419:53d2:83d0 with SMTP id w9-20020a05640234c900b0041953d283d0mr31905733edc.308.1649073851857; Mon, 04 Apr 2022 05:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649073851; cv=none; d=google.com; s=arc-20160816; b=wogIvQqKWrPllp26w1lWKrZKTS5gfp8YRMhs9vDXD8J+o+H6uEBCn4ewBw/erSNQ5Y NOR1hM9ftYV2LsuhtFdDnndC6Scx8avHT83z4jooUp5HcMhp8tzgoGlFwlwRy48nf3Ip OBYPtlThaeie1ztgyDZyr2lSMfFB9+CIN/rR5KGFNF2Z614fUl296/OqiWVqwxab4q58 JvGfk6CPNHJxDu+T1Q0HymIxBdBHNUsc/4nZdguPbTANUFCBfsOUFinFIYa6nbiA/jQ3 NYRZ4G3CuKL6DjCYp4NcZwhIj9AbH8E0NUue6GHCT5NKCEcbVrZBzpZA7FlPYRs0jeZ/ J25w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=uQ8Ojma+yInShcILYo+mLtzhqnSh9bMS9txCFbqe7Rc=; b=QJQ402UwJJbhD+LhqE3I5fw5EYcMVcBCXbrMrNgTdPVFbsaBVUU31VjQZLL8a6oQFq U3O/VbT7hPoXS+KtJbUXorT4X0QwIMCjuLo0kSwCRWyzW0iSHJiQHxeF+SnQLhKhOtNS w9kWjupcCu88b3ID3o2XNmifRTNUOAqIxwBLMi/d1erjCjbzA42nJjSkuzeML2A2bkDK tTN8+/Qya8mjREG2yvwCbjTfmOMePWoNU4t7NiC+yV7p3rmm3qKNUySx4M7l9kpC/vWQ FC9pmOT2oY0NdMDDAUtQhLUAAXRhZ0u5aMpEg2tyQNzz+Oi62BR3iSMlPizn3Z+c5Kaw Yj1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=Rx5AiT28; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=DaHEwqIs; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gj10-20020a170907740a00b006e7ef40a0e9si1852530ejc.165.2022.04.04.05.03.45; Mon, 04 Apr 2022 05:04:11 -0700 (PDT) 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; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=Rx5AiT28; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=DaHEwqIs; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355091AbiDBNMt (ORCPT + 99 others); Sat, 2 Apr 2022 09:12:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355083AbiDBNMs (ORCPT ); Sat, 2 Apr 2022 09:12:48 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9C5C136663; Sat, 2 Apr 2022 06:10:56 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 330645C010D; Sat, 2 Apr 2022 09:10:56 -0400 (EDT) Received: from imap47 ([10.202.2.97]) by compute2.internal (MEProxy); Sat, 02 Apr 2022 09:10:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; bh=uQ8Ojma+yInShcILYo+mLtzhqnSh9b MS9txCFbqe7Rc=; b=Rx5AiT285BmD1NR36x2quZ4Ky5uw+aXPrUGeGyuyrDbZ39 +e5MovBblY6YxBESEc/SCOB6CnzI0H0J90R7jF9gqGbRpu6o9mm49ua5cALpaUh2 kWaacSt25ocKa6j4a4UVQruq1AwCnSxBD82X3wseqIhzG28iTjMcCLkNbvcQwp0Q dqQuXOpOtkvfMkyPWGAntmZEvDy9uXXCRGLMtefF5cgmj0LvB/SUQ5RMx2u96Q+A GywHPDtrYTHEVTbvfBB9WhdlzpnRNtxul7oK+3bSZRof/JFGEwBAGAYPO/D5RURT jhWpYPnmElgCs131EyFzKi8MV+/0ih/fYewQRYzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=uQ8Ojma+yInShcILY o+mLtzhqnSh9bMS9txCFbqe7Rc=; b=DaHEwqIsdFgckFEc4sCL/Or4XueRC6gxn dVUvg1XIqmUZ+IyeTF4lZfREgZWi17+XK7O1on5FGWeg8PeCXAW9w4WDYRq1Pg5J SKsiUPmPrRKgI05z/ws7vJ5ybxX47DtlVik2JmaUeLeQRlyiFL85ECmqhO8hf+O0 u/Uumfl+D1WbAmvFd7CQigfp4HaJnqfrqIhTwoWLhxDK7wFo6K4voHp8AWpbtvvl mSnfXXsev8lxDj8H3aCg6ialNx5118+9ov0mFboVuw7/GvusoFxTZ4kyrxR72BqK zmijXvFtNaaRjwKIcxIG52mGAztePeaNYepF/5KuSQgr42Azm2H8A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeikedgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfuvhgv nhcurfgvthgvrhdfuceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrg htthgvrhhnpefgieegieffuefhtedtjefgteejteefleefgfefgfdvvddtgffhffduhedv feekffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsvhgvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 9E07027404A0; Sat, 2 Apr 2022 09:10:55 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-382-g88b93171a9-fm-20220330.001-g88b93171 Mime-Version: 1.0 Message-Id: <96fcc1ec-888a-4ff2-a41b-8cc352d4f2b1@www.fastmail.com> In-Reply-To: References: <20220321165049.35985-1-sven@svenpeter.dev> <20220321165049.35985-7-sven@svenpeter.dev> Date: Sat, 02 Apr 2022 15:10:34 +0200 From: "Sven Peter" To: "Keith Busch" Cc: "axboe@fb.com" , "hch@lst.de" , "sagi@grimberg.me" , "Hector Martin" , "Alyssa Rosenzweig" , "Rob Herring" , "Arnd Bergmann" , "Marc Zyngier" , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Subject: Re: [PATCH 6/9] nvme-apple: Add initial Apple SoC NVMe driver Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Mon, Mar 21, 2022, at 18:01, Keith Busch wrote: > On Mon, Mar 21, 2022 at 05:50:46PM +0100, Sven Peter wrote: >> +static bool apple_nvme_poll_cq(struct apple_nvme_queue *q, >> + struct io_comp_batch *iob) >> +{ >> + bool found = false; >> + >> + while (apple_nvme_cqe_pending(q)) { >> + found = true; >> + >> + /* >> + * load-load control dependency between phase and the rest of >> + * the cqe requires a full read memory barrier >> + */ >> + dma_rmb(); >> + apple_nvme_handle_cqe(q, iob, q->cq_head); >> + apple_nvme_update_cq_head(q); >> + } >> + >> + if (found) >> + writel_relaxed(q->cq_head, q->cq_db); > > Doesn't a relaxed write mean that a subsequent write can bypass the previous? > If so, that sounds like it can corrupt the cq head. No, writel_relaxed just means there's no synchronization barrier for writes to normal memory and that those could bypass the store to device memory and only become visible later. The underlying memory (q->cq_db) is still mapped as Device-nGnRnE which prevents reordering of writes to the same endpoint such that the N-th CQ update is still guaranteed to be visible to the device before the N+1-th CQ update. I'll either add a comment why it's okay to use _relaxed here or just use writel instead since there doesn't seem to be any performance difference. Sven