[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 03/10] xen/arm: smmuv3: Ensure queue is read after updating prod pointer


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Mon, 5 Sep 2022 09:18:43 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gWAw9AizrppWbMqtmNqglZxSrRobWCsQT9g/gRle4DY=; b=EwK6M4hv/UHsvTf6BpRA/8HdXKEmlJ6r6yPuQ2lEwbln/AFdiBgd5yofAVO2IzWFgE1TnbmX/qeye/A1jI+L/OlpfT/iRyr9gtwyVoOvSpRpevzg25RsppI0RIvd8oahRZ5hfRGnaaKZ6o/7rMfjQi84d1ysbnIwIOgQv5eyCV3ukz921rPs5J64ivqunI9c11jLvX4WGPz/cw5iP8ss9xVh/uOTkv1dbmmDhINEujzI1zFqTdCOsclkpFA3aKzAhPpIWo04pKKUAnJY5elBhm2uwTilHFDKT4qbbVct7L1WejcDpAT6WrLy2ElOuZ3YtqNcIuMZpWt7JrbECAj0JQ==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gWAw9AizrppWbMqtmNqglZxSrRobWCsQT9g/gRle4DY=; b=Hg67Eo6/eCsUBnJLa4N2R1FcWSY/5Ll+6594HDfcTit/Qb+osMgy1zft1WwFM8dWoWgPrzVtaEG3gofghYhpJ2mdOHCt0OyN5KY4AkE4dR0Rg02BenUOLalvdN3wCQ7H3unDdJ/8vhku9LszRBqnqQ2hYJpcpxiseOw9T2LIg4YpI/DkYM6jlx5zYdBR+rUiqhv54kGnYrDCBcXxVG1e0UyUXqRW5OaPCdKbKNpSWdSoXlSg3h2/ecYWHJpol5BjJKTM33Ujw6Zun0GXu3mmdwKBFp39iSqsfrXpH3vA3eP+eWhexgl2NNzv4a3XQbc4ljGxA2LMVMbkmhXN+5MiJg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Kop3AoSVgR10dFWQaqbw2NqFzeR9dryr6dN9X4dgdx6j6OgnxypM7ZXV/ROj8Oa/hRIeSwdXb852sNIxnRlXgOieBbgJv2oKzStEbyQ1ce+TQZzJkwVa39tgT6Rfof4u1IqNOjM4ltBGBgd27rRa4XbI4Egx/QI2q50N9vE8/tv958HO/ou7Jzsub6+o5Ng5OKJvKUJscNyuY3eV4IRsvnOZB8EaMcgCqjpYAMYDSehB1cuvCCKUrmWoOHvbyki813V95UAfOtWUcKzWu3+ZNV+hz3OVC/vUpC72cZ6q5dnO1m5oNCswaBCkAUYMH+uqgvhpMBdde6bnW8vM6emDvA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LwoLB8XQ2OtWeSXu3z6yZISZoBXdcUITQ5BL8t+XVzzvxaiUqsHGwa2uaAeP4QpzEygCFIvkVYjZRnGJJk+whfnYXiWs/bp4eFSzI6m5q3p7laeEfus0hR20UEfRij7/74/RqhZuA3Eox3MjYaqVj3wPLibbg8k2/8son6a30CRwIKHatyqeGK25hbMVF5BxC8dQSmeQrgO3//UvXSzvbsgS2HPyJNoqBWB9jqac7OWi2rhPtNDi85gz6LCUo25ftKzMPB+7y6rjMl6nRsb2PkCx4gw5KvVYuNwdHlqy2L+ytXWiEFNEYJu9y21/8sYuY+M6WjEAhUjCr20QAhYevQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Zhou Wang <wangzhou1@xxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Will Deacon <will@xxxxxxxxxx>
  • Delivery-date: Mon, 05 Sep 2022 09:18:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYvtEAJSRg4g4gWEG/XWmXvqw9I63Mx8YAgAPLkwA=
  • Thread-topic: [PATCH v2 03/10] xen/arm: smmuv3: Ensure queue is read after updating prod pointer

Hi Stefano,

> On 3 Sep 2022, at 12:21 am, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> On Fri, 2 Sep 2022, Rahul Singh wrote:
>> From: Zhou Wang <wangzhou1@xxxxxxxxxxxxx>
>> 
>> Backport Linux commit a76a37777f2c. This is the clean backport without
>> any changes.
>> 
>> Reading the 'prod' MMIO register in order to determine whether or
>> not there is valid data beyond 'cons' for a given queue does not
>> provide sufficient dependency ordering, as the resulting access is
>> address dependent only on 'cons' and can therefore be speculated
>> ahead of time, potentially allowing stale data to be read by the
>> CPU.
>> 
>> Use readl() instead of readl_relaxed() when updating the shadow copy
>> of the 'prod' pointer, so that all speculated memory reads from the
>> corresponding queue can occur only from valid slots.
>> 
>> Signed-off-by: Zhou Wang <wangzhou1@xxxxxxxxxxxxx>
>> Link: 
>> https://lore.kernel.org/r/1601281922-117296-1-git-send-email-wangzhou1@xxxxxxxxxxxxx
>> [will: Use readl() instead of explicit barrier. Update 'cons' side to match.]
>> Signed-off-by: Will Deacon <will@xxxxxxxxxx>
>> Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
>> a76a37777f2c
>> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
>> ---
>> Changes in v2:
>> - fix commit msg
>> - add _iomb changes also from the origin patch
>> ---
>> xen/arch/arm/include/asm/system.h     |  1 +
>> xen/drivers/passthrough/arm/smmu-v3.c | 11 +++++++++--
>> 2 files changed, 10 insertions(+), 2 deletions(-)
>> 
>> diff --git a/xen/arch/arm/include/asm/system.h 
>> b/xen/arch/arm/include/asm/system.h
>> index 65d5c8e423..fe27cf8c5e 100644
>> --- a/xen/arch/arm/include/asm/system.h
>> +++ b/xen/arch/arm/include/asm/system.h
>> @@ -29,6 +29,7 @@
>> #endif
>> 
>> #define smp_wmb()       dmb(ishst)
>> +#define __iomb()        dmb(osh)
> 
> We don't have any other #define starting with __ in system.h.
> I wonder if we should call this macro differently or simply iomb().
 
I think either iomb() or dma_mb() will be the right name.
Please let me know your view on this.

Regards,
Rahul


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.