Wei Wang2
2008-Apr-02 14:13 UTC
[Xen-devel] [PATCH] AMD IOMMU: Defer IO pagetable construction until device assignment
During HVM domain creation, I/O page tables are filled by coping p2m entries from p2m table, which is a useless step for non-passthru domain. This patch defers I/O page table construction until the moment of device assignment. In case that pci devices are never assigned or hot plugged, the unnecessary duplication will be avoid. Wei Signed-off-by: Wei Wang <wei.wang2@amd.com> -- AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Apr-02 14:52 UTC
Re: [Xen-devel] [PATCH] AMD IOMMU: Defer IO pagetable construction until device assignment
On 2/4/08 15:13, "Wei Wang2" <wei.wang2@amd.com> wrote:> During HVM domain creation, I/O page tables are filled by coping p2m > entries from p2m table, which is a useless step for non-passthru domain. > This patch defers I/O page table construction until the moment of device > assignment. In case that pci devices are never assigned or hot plugged, > the unnecessary duplication will be avoid.You can''t duplicate p2m_lock() and p2m_unlock(). Why do you need to protect your new function with that lock anyway? -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei Wang2
2008-Apr-02 15:25 UTC
Re: [Xen-devel] [PATCH] AMD IOMMU: Defer IO pagetable construction until device assignment
On Wed, 2008-04-02 at 16:07 +0100, Keir Fraser wrote:> Then the logic is wrong because new p2m entries could be created after > construct_p2m_mapping() is completed but before reassign_device() makes the > guest''s pdev_list non-empty.Yes, thanks for catching that.> I think you should leave p2m.c as it is, and then synchronise on creation of > the iommu tables from within amd_iommu_map_page(). You already have a > mapping_lock in there which might do the trick.I will update it. Maybe I need a new flag to indicate that I/O page tables has been synchronised.. Wei> -- Keir > > On 2/4/08 15:56, "Wei Wang2" <wei.wang2@amd.com> wrote: > > > I just want to make sure that no new p2m entries are written during the > > copy procedure. > > Wei > > On Wed, 2008-04-02 at 16:52 +0200, Keir Fraser wrote: > >> On 2/4/08 15:13, "Wei Wang2" <wei.wang2@amd.com> wrote: > >> > >>> During HVM domain creation, I/O page tables are filled by coping p2m > >>> entries from p2m table, which is a useless step for non-passthru > >> domain. > >>> This patch defers I/O page table construction until the moment of > >> device > >>> assignment. In case that pci devices are never assigned or hot > >> plugged, > >>> the unnecessary duplication will be avoid. > >> > >> You can''t duplicate p2m_lock() and p2m_unlock(). Why do you need to > >> protect > >> your new function with that lock anyway? > >> > >> -- Keir > >> > >> > >> > >> > >> > > > > > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Apr-02 15:26 UTC
Re: [Xen-devel] [PATCH] AMD IOMMU: Defer IO pagetable construction until device assignment
On 2/4/08 16:25, "Wei Wang2" <wei.wang2@amd.com> wrote:>> I think you should leave p2m.c as it is, and then synchronise on creation of >> the iommu tables from within amd_iommu_map_page(). You already have a >> mapping_lock in there which might do the trick. > I will update it. Maybe I need a new flag to indicate that I/O page tables has > been synchronised..Set and checked under the mapping lock. Yes, that would indeed work. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei Wang2
2008-Apr-04 12:34 UTC
Re: [Xen-devel] [PATCH] AMD IOMMU: Defer IO pagetable construction until device assignment
Retry for comment, Thanks! During HVM domain creation, I/O page tables are filled by coping p2m entries from p2m table, which is a useless step for non-passthru domain. This patch defers I/O page table construction until the moment of device assignment. In case that pci devices are never assigned or hot plugged, the unnecessary duplication will be avoid. Wei Signed-off-by: Wei Wang <wei.wang2@amd.com> -- AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy On Wed, 2008-04-02 at 16:26 +0100, Keir Fraser wrote:> > > On 2/4/08 16:25, "Wei Wang2" <wei.wang2@amd.com> wrote: > > >> I think you should leave p2m.c as it is, and then synchronise on creation of > >> the iommu tables from within amd_iommu_map_page(). You already have a > >> mapping_lock in there which might do the trick. > > I will update it. Maybe I need a new flag to indicate that I/O page tables has > > been synchronised.. > > Set and checked under the mapping lock. Yes, that would indeed work. > > -- Keir > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel