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

Re: [PATCH v4 13/21] IOMMU/x86: prefill newly allocate page tables


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 20 May 2022 12:47:55 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=KyLuuJQ99pGXy4h9taQ/mipk4urv5Fp+BoDS2GaMjiI=; b=oNjO/MKknttQFBoNbAklpYSvdKfMJPnLM3YT7R7EGDsDCkJTz6S1yWWO99/sOpvdft/IDk7SOkzgX7Ug48ZIWzZm1vidHpaGjTbX0bVSboqRpsAydmWn/16G5dlDz4WbsqZqP1iJzt1yZF1IvcxFgjHB//5z7uLHQ0YXriId2OzYJTDPf4k//c0vLJFmmZqJBupHzpVhRkc1xUfK6UUq8fKbYoof4l6SqeFJRo95Bj7JuSmnmwW4MP/ToybXdNFI3VTXrSd4pB9zpuI3wfZpER2oeFiIhhM63kSfPl3Xh1KqIZRErlipx1YzwVdaOLYbFfETZpHHYWRkJm+DDQMQMw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QIGTMIJ825lBwt8pksG4KcvscVnsjuZCQ4nESjfCiIbuXMNHDk5lybiO1+NK0nQHoBtJ7HfjAKDyQicLqYyh1/J77bRd+hHvIKwooTHTXoIHZjhRpgLKKayOX6tT2TNkSfJ/qRw7MueoVTAbfvNXwP4QKUAsDGCJcv1II5lZtHLxdzmguJtnwYv/F5Lq1Xx/GeScqGmSgOij+ZaYNXdMgM0GMISyku2Z1OLBU4UItrW3smfNb3WfaFSJ5an9xivQ8OmWtlrRL9Pazj/kQJlVMroa1fptN+KYYOJvbyfFHPYUwNANhzXf4uGnjr+kggX1j4usTNIiZ426JblcyCV+fg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 20 May 2022 10:48:12 +0000
  • Ironport-data: A9a23:O2hRWqIpzpBtIB/nFE+Rq5QlxSXFcZb7ZxGr2PjKsXjdYENS1jwCy WJMX2GCOvjYNjPwfdFxaY21p0hU6J+Gy4M2SwRlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokf0/0vrav67xZVF/fngqoDUUYYoAQgsA149IMsdoUg7wbRh39Qw2YHR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 MlxtMGIGTh4AvaWhcEncz1+FwE5M7ITrdcrIVDn2SCS52vvViK1ht9IXAQxN4Be/ftrC2ZT8 /BeMCoKch2Im+OxxvS8V/VogcMgasLsOevzuFk5lW2fUalgHMCFGvqVjTNb9G5YasRmB/HRa tBfcTNyRB/BfwdOKhEcD5dWcOKA2SCgI2AC+Q/9SawfvCvwiyB6zPvXK9uEQOeGGsVbv2qCq TeTl4j+KlRAXDCF8hKH+H+xgu7EnQvgRZkfUra/85ZCkFCVg2AeFhASfV+6uuWizF6zXcpFL E4Z8TZoqrI9nGSzR8T5dw21pjiDpBF0c8VUO/037keK0KW83uqCLm0NTzoEYtp2ssYzHGUuz gXQwIyvAiFzurqIT37b7q2TsT65JSkSKykFeDMASgwGpdLkpenfky7yczqqK4bt5vWdJN066 2niQPQW71nLsfM26g==
  • Ironport-hdrordr: A9a23:gEHvAqg0a4QPANcYvKZ1HF/teXBQX0h13DAbv31ZSRFFG/FwyP rCoB1L73XJYWgqM03I+eruBEBPewK4yXdQ2/hoAV7EZnichILIFvAa0WKG+VHd8kLFltK1uZ 0QEJSWTeeAd2SS7vyKnzVQcexQp+VvmZrA7Ym+854ud3ANV0gJ1XYENu/xKDwTeOApP+taKH LKjfA32gZINE5nJ/iTNz0gZazuttfLnJXpbVovAAMm0hCHiXeN5KThGxaV8x8CW3cXqI1Sul Ttokjc3OGOovu7whjT2yv66IlXosLozp9mCNaXgsYYBz3wgkKDZZhnWZeFoDcpydvfoGoCoZ 3pmVMNLs5z43TeciWcpgbs4RDp1HIU53rr2Taj8A/eiP28YAh/J9tKhIpffBecwVEnpstA3K VC2H/cn4ZLDDvb9R6NqOTgZlVPrA6ZsHAimekcgzh0So0FcoJcqoQZ4Qd8DIoAJiTn84oqed MeQP003MwmMG9yUkqp/lWGmLeXLzcO91a9MwU/U/WuonZrdCsT9Tpb+CQd9k1wga7VBaM0ot gsCZ4Y5Y2mfvVmE56VO91xMfdfKla9Ni4kY1jiV2gOKsk8SgHwgq+yxokJz8eXX7FN5KcOuf 36ISFlXCgJCgjTNfE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, May 19, 2022 at 02:12:04PM +0200, Jan Beulich wrote:
> On 06.05.2022 13:16, Roger Pau Monné wrote:
> > On Mon, Apr 25, 2022 at 10:40:55AM +0200, Jan Beulich wrote:
> >> ---
> >> An alternative to the ASSERT()s added to set_iommu_ptes_present() would
> >> be to make the function less general-purpose; it's used in a single
> >> place only after all (i.e. it might as well be folded into its only
> >> caller).
> > 
> > I would think adding a comment that the function requires the PDE to
> > be empty would be good.
> 
> But that's not the case - what the function expects to be clear is
> what is being ASSERT()ed.
> 
> >  Also given the current usage we could drop
> > the nr_ptes parameter and just name the function fill_pde() or
> > similar.
> 
> Right, but that would want to be a separate change.
> 
> >> --- a/xen/drivers/passthrough/amd/iommu_map.c
> >> +++ b/xen/drivers/passthrough/amd/iommu_map.c
> >> @@ -115,7 +115,19 @@ static void set_iommu_ptes_present(unsig
> >>  
> >>      while ( nr_ptes-- )
> >>      {
> >> -        set_iommu_pde_present(pde, next_mfn, 0, iw, ir);
> >> +        ASSERT(!pde->next_level);
> >> +        ASSERT(!pde->u);
> >> +
> >> +        if ( pde > table )
> >> +            ASSERT(pde->ign0 == find_first_set_bit(pde - table));
> >> +        else
> >> +            ASSERT(pde->ign0 == PAGE_SHIFT - 3);
> > 
> > I think PAGETABLE_ORDER would be clearer here.
> 
> I disagree - PAGETABLE_ORDER is a CPU-side concept. It's not used anywhere
> in IOMMU code afaics.

Isn't PAGE_SHIFT also a CPU-side concept in the same way?  I'm not
sure what's the rule for declaring that PAGE_SHIFT is fine to use in
IOMMU code  but not PAGETABLE_ORDER.

Thanks, Roger.



 


Rackspace

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