Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2868423pxb; Tue, 21 Sep 2021 09:20:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ5bvZR/Ll9SPj2I1PiHreT7KzlbpzZkTQJU+cGsNSYI05uQoKLb8Q26lnslgYGuA8/rsr X-Received: by 2002:a02:cdd9:: with SMTP id m25mr704817jap.137.1632241253294; Tue, 21 Sep 2021 09:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632241253; cv=none; d=google.com; s=arc-20160816; b=XMsF3Pzoor9Sto8r+/jWkM9T9LY4R9/dJ26y4e5yrdJbui/fgp6Uj18HfrzvEhpNV5 neS5kxSWJp0FGLPopD5IhqGI8XnzPpLTmPl6FVi2laky7rWhi47Eq4FWltpBQgXG0ch2 IpdtJjfsxMg3pbfwMUaTeg067c7k5Vgi3DbLgTEs+y0WZiYxorSPNtkav5fh4v+NcaVa N5RRX+dO0ZQpSZ14uQP7QQkCdpk8C1okPoEnUx6owsIQYI8pUqAilpU8BrTcUOJgtJqT OxS+5dYkIv7uF8AzTTjNvnqwaBfA/U3BeXCWmDNV6ybZFR9jxjNie8o8A1LvPjhxJliX sXog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=OKQEQrQXpac2K16MxkZgZcgdjgYK4ZmGbW1lSEC5SwY=; b=uPa+OeZ6pIouMlOmenT7q/BZxM+E4xYOozoBdHSdpcqhvHuXAEha9taFVXJXg3r52h MzsfMX9kkKPLFmK/H6pHmwcWHjxaIMQi5CyzWqZ0PMJH00Q55d1Ultc0HO0Vd7yyURGM 698JR4SUBS4uyi3u79BzsHVwwmm9QL+WkbgGE1D8IbQlKB3oP605N719IMAKsUtK/jkE 3G5rNvTpJNN8GAdDi+YQRmDrKYR+1IeFtl6Vpw3gRoiuAhGLZyYmGAsjE4ZPJuldBwkA vOoxFfAs2QVo52VXZq+jUtk/pvVKXgVew/zWx1KNcBp3/ZXKQfZGqoj4/VgrSC5EVDOw tvpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si16818415jan.84.2021.09.21.09.20.40; Tue, 21 Sep 2021 09:20:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234535AbhIUQV2 (ORCPT + 99 others); Tue, 21 Sep 2021 12:21:28 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3849 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234798AbhIUQVA (ORCPT ); Tue, 21 Sep 2021 12:21:00 -0400 Received: from fraeml701-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4HDRQN2PlBz67Cqk; Wed, 22 Sep 2021 00:17:00 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml701-chm.china.huawei.com (10.206.15.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Tue, 21 Sep 2021 18:19:28 +0200 Received: from [10.47.82.229] (10.47.82.229) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Tue, 21 Sep 2021 17:19:28 +0100 Subject: Re: [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space To: Fernand Sieber , , CC: , , References: <20210921114338.1144521-1-sieberf@amazon.com> From: John Garry Message-ID: Date: Tue, 21 Sep 2021 17:22:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20210921114338.1144521-1-sieberf@amazon.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.82.229] X-ClientProxiedBy: lhreml736-chm.china.huawei.com (10.201.108.87) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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