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

Re: [PATCH v2 14/18] IOMMU: fold flush-all hook into "flush one"


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 14 Dec 2021 10:06:37 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=OUJO2ATnb/S47w7qGDSgAIqT00NDkfzbeWMH0qFrAzw=; b=l+X8iVB4mY4/rQLTTACqewdtkocGAamGfHw7JTrUiB+6j8XMrF2U9vtkC1x/qAq/72/a+lrI7uqKoLJlVf3Xziv2NEqpBUaJT/RtAFAKe5w5+Tq6a6+Yau+S+lckpJBw6LJuvh0FlbS5GHk3A6K145SWuZMKlUG0LeHzr7x+K6xjSdebd5isd2s4VWZg857rL5kyVCdJhp27EVYUYiqJT3LKcDGfBi6oyQ9eBHZ6TSIaD8/hQKhJCpjQ0Q4jI9Zl9ElM1gjpuLPdiUy1fDOn4Hu7L+1iNUz1ol63uhDVPFT3bvQf0fYVw+kKpVpP5PcnnCBVhzFQeYemCUpVJkM72Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=erNBjw3cmoh7bqg3JG/Emdkzp4AxtcJ+dZ0tnaZM1xPER3oq5s2C7l2VGPRYm8dTMv4zm224w39xfhDdotJTkp5XbW6Aot6qv+k7LGvFp00146Le9p3EN8tWpfZt7tvJ/9BSkrcUJsi47z7Wi9ljK36tFdh/+ocbNMmztJsl49fwhu3om6VHDN1Mr3EzUUR0qg41VKI4eiaH0whjyr14WZqvSwd3A0wmHO238Cyo6SNzNtQujThvbktztb+VMVnvtEzkjhuMJM7lD98lX+XybKgW6ibN11HROezmKf21P2gectU+GskPNrp/OpKzROR+nOQ+mdee/QC8tQPy4Fd54A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <Rahul.Singh@xxxxxxx>
  • Delivery-date: Tue, 14 Dec 2021 09:07:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.12.2021 16:04, Roger Pau Monné wrote:
> On Fri, Sep 24, 2021 at 11:53:59AM +0200, Jan Beulich wrote:
>> Having a separate flush-all hook has always been puzzling me some. We
>> will want to be able to force a full flush via accumulated flush flags
>> from the map/unmap functions. Introduce a respective new flag and fold
>> all flush handling to use the single remaining hook.
>>
>> Note that because of the respective comments in SMMU and IPMMU-VMSA
>> code, I've folded the two prior hook functions into one. For SMMU-v3,
>> which lacks a comment towards incapable hardware, I've left both
>> functions in place on the assumption that selective and full flushes
>> will eventually want separating.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Just one nit I think.
> 
>> --- a/xen/drivers/passthrough/vtd/iommu.c
>> +++ b/xen/drivers/passthrough/vtd/iommu.c
>> @@ -731,18 +731,21 @@ static int __must_check iommu_flush_iotl
>>                                                  unsigned long page_count,
>>                                                  unsigned int flush_flags)
>>  {
>> -    ASSERT(page_count && !dfn_eq(dfn, INVALID_DFN));
>> -    ASSERT(flush_flags);
>> +    if ( flush_flags & IOMMU_FLUSHF_all )
>> +    {
>> +        dfn = INVALID_DFN;
>> +        page_count = 0;
> 
> Don't we expect callers to already pass an invalid dfn and a 0 page
> count when doing a full flush?

I didn't want to introduce such a requirement. The two arguments should
imo be don't-cares with IOMMU_FLUSHF_all, such that callers handing on
(or accumulating) flags don't need to apply extra care.

> In the equivalent AMD code you didn't set those for the FLUSHF_all
> case.

There's no similar dependency there in AMD code. For VT-d,
iommu_flush_iotlb() needs at least one of the two set this way to
actually do a full-address-space flush. (Which, as an aside, I've
recently learned is supposedly wrong when cap_isoch() returns true. But
that's an orthogonal issue, albeit it may be possible to deal with at
the same time as, down the road, limiting the too aggressive flushing
done by subsequent patches using this new flag.)

I could be talked into setting just page_count to zero here.

Jan




 


Rackspace

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