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 X-Spam-Level: X-Spam-Status: No, score=-4.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_ALL,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1053C433F5 for ; Tue, 21 Sep 2021 17:14:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4BA661002 for ; Tue, 21 Sep 2021 17:14:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B4BA661002 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:CC:To:From:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Fc2zwnCyzhuwRIPWJNl0J8e/8SntRHFhULseILCakFg=; b=fAU5Mz9fNQNsBL raYskvpiSevBC9LDFv6uPW/H/cM0rRwGNfX1bOTPLw++FwI71B6B0AG1+IalZsx5u8YEtA2gzHEP/ duljFyCuMR5pXumBQS8lmV7n284+e+SJs9vWUJ2haEKFKN6xEHiCH/E1DZK3jhoIwRUgEzG242dW5 iAT4BkOonfMgPAgpexx5VfRvNdChvH2gLVBdRxXzmLkt27pAdvt+YAthfJPDjF2ixrQZcHaLXoQyX caaDdmw3ukFtwbeJjZuRJhedw+dk//x79CKpB83moXafuWToKhxLoatLTquVArzUhMcHMLjJ6ctYE p4D8JsuPkzLhpMAmyGOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSjK7-005Iqz-J2; Tue, 21 Sep 2021 17:12:51 +0000 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSjK3-005Ioc-Gj for linux-arm-kernel@lists.infradead.org; Tue, 21 Sep 2021 17:12:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1632244368; x=1663780368; h=from:to:cc:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:subject; bh=16YU7KkjpiOEAKPRsxoOGSp6GaxRIbNZG8DW2Dc8Nxc=; b=Gztj9Hsmff3oiH1T4Q1emTxbGVa2D8Xo97KtgUTsbu5sodm2GTynrbOx Hs0yyxK2Azhe19RKPDofWTHeaSEWN/CNuFMpt87giX6ayQOqJWz7qEeJg k02K8AMqvV2MB2MY4dsxoovCkjc9GAaszQ5W3k1kLvplPcl9H1XZ0//uU o=; X-IronPort-AV: E=Sophos;i="5.85,311,1624320000"; d="scan'208";a="143494894" Subject: Re: [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space Thread-Topic: [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-iad-1d-1c3c2014.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-6001.iad6.amazon.com with ESMTP; 21 Sep 2021 17:12:29 +0000 Received: from EX13D03EUA004.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-iad-1d-1c3c2014.us-east-1.amazon.com (Postfix) with ESMTPS id 947D5CB307; Tue, 21 Sep 2021 17:12:27 +0000 (UTC) Received: from EX13D03EUA004.ant.amazon.com (10.43.165.93) by EX13D03EUA004.ant.amazon.com (10.43.165.93) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 21 Sep 2021 17:12:26 +0000 Received: from EX13D03EUA004.ant.amazon.com ([10.43.165.93]) by EX13D03EUA004.ant.amazon.com ([10.43.165.93]) with mapi id 15.00.1497.023; Tue, 21 Sep 2021 17:12:26 +0000 From: "Sieber, Fernand" To: John Garry , "will@kernel.org" , "robin.murphy@arm.com" CC: "linux-arm-kernel@lists.infradead.org" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Thread-Index: AQHXrt3+ZWYnaFhO3kmkBSrWrVwBSauurBkAgAAMX78= Date: Tue, 21 Sep 2021 17:12:25 +0000 Message-ID: <1632244345526.44611@amazon.com> References: <20210921114338.1144521-1-sieberf@amazon.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.43.160.90] MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210921_101247_731522_BB9296E9 X-CRM114-Status: GOOD ( 16.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi John, > But is the polarity really correct? That is, if we don't have space, > then exit with success (the function to check for space). You are absolutely correct, this is a mistake that I made as I was resolving conflicts while porting this patch to iommu/next from 5.4 where I implemented and tested it. It should be: > - if (!queue_full(llq)) > + if (queue_has_space(llq, n)) > what is llq->state->val? This is an other oversight for the same reason, llq->state->val has since then been renamed llq->val Will fix both of these in the next revision. Thanks and kind regards, --Fernand ________________________________________ From: John Garry Sent: Tuesday, September 21, 2021 18:22 To: Sieber, Fernand; will@kernel.org; robin.murphy@arm.com Cc: linux-arm-kernel@lists.infradead.org; iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org Subject: RE: [EXTERNAL] [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. On 21/09/2021 12:43, Fernand Sieber wrote: > do { I didn't follow the full logic of this change yet ... > llq->val = READ_ONCE(cmdq->q.llq.val); > - if (!queue_full(llq)) > + if (!queue_has_space(llq, n)) But is the polarity really correct? That is, if we don't have space, then exit with success (the function to check for space). > break; > > + /* > + * We must return here even if there's no space, because the producer > + * having moved forward could mean that the last thread observing the > + * SMMU progress has allocated space in the cmdq and moved on, leaving > + * us in this waiting loop with no other thread updating > + * llq->state->val. what is llq->state->val? > + */ > + if (llq->prod != prod) > + return -EAGAIN; > + > ret = queue_poll(&qp); Thanks, John _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel