From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Yang Z Zhang <yang.z.zhang@intel.com>,
Dario Faggioli <dario.faggioli@citrix.com>,
Kevin Tian <kevin.tian@intel.com>
Subject: Re: [PATCH 4/5] VT-d: widen NUMA nodes to be allocated from
Date: Thu, 5 Mar 2015 17:08:31 +0000 [thread overview]
Message-ID: <54F88D8F.7050908@citrix.com> (raw)
In-Reply-To: <54EF33E00200007800064148@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 6079 bytes --]
On 26/02/15 13:55, Jan Beulich wrote:
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
I believe that this change is incorrect.
>
> --- a/xen/drivers/passthrough/vtd/extern.h
> +++ b/xen/drivers/passthrough/vtd/extern.h
> @@ -67,7 +67,8 @@ unsigned int get_cache_line_size(void);
> void cacheline_flush(char *);
> void flush_all_cache(void);
>
> -u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
> +u64 alloc_pgtable_maddr(struct acpi_drhd_unit *, unsigned int npages,
> + struct domain *);
> void free_pgtable_maddr(u64 maddr);
> void *map_vtd_domain_page(u64 maddr);
> void unmap_vtd_domain_page(void *va);
> --- a/xen/drivers/passthrough/vtd/intremap.c
> +++ b/xen/drivers/passthrough/vtd/intremap.c
> @@ -739,7 +739,8 @@ int enable_intremap(struct iommu *iommu,
> if ( ir_ctrl->iremap_maddr == 0 )
> {
> drhd = iommu_to_drhd(iommu);
> - ir_ctrl->iremap_maddr = alloc_pgtable_maddr(drhd, IREMAP_ARCH_PAGE_NR);
> + ir_ctrl->iremap_maddr = alloc_pgtable_maddr(drhd, IREMAP_ARCH_PAGE_NR,
> + NULL);
> if ( ir_ctrl->iremap_maddr == 0 )
> {
> dprintk(XENLOG_WARNING VTDPREFIX,
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -185,7 +185,8 @@ void iommu_flush_cache_page(void *addr,
> }
>
> /* Allocate page table, return its machine address */
> -u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
> +u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned int npages,
> + struct domain *d)
> {
> struct acpi_rhsa_unit *rhsa;
> struct page_info *pg, *cur_pg;
> @@ -195,10 +196,10 @@ u64 alloc_pgtable_maddr(struct acpi_drhd
>
> rhsa = drhd_to_rhsa(drhd);
> if ( rhsa )
> - node = pxm_to_node(rhsa->proximity_domain);
> + node = pxm_to_node(rhsa->proximity_domain);
>
> - pg = alloc_domheap_pages(NULL, get_order_from_pages(npages),
> - (node == NUMA_NO_NODE) ? 0 : MEMF_node(node));
> + pg = alloc_domheap_pages(d, get_order_from_pages(npages),
> + MEMF_node(node) | MEMF_no_owner);
> if ( !pg )
> return 0;
>
> @@ -223,7 +224,7 @@ void free_pgtable_maddr(u64 maddr)
> }
>
> /* context entry handling */
> -static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
> +static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus, struct domain *d)
> {
> struct acpi_drhd_unit *drhd;
> struct root_entry *root, *root_entries;
> @@ -235,7 +236,7 @@ static u64 bus_to_context_maddr(struct i
> if ( !root_present(*root) )
> {
> drhd = iommu_to_drhd(iommu);
> - maddr = alloc_pgtable_maddr(drhd, 1);
> + maddr = alloc_pgtable_maddr(drhd, 1, d);
> if ( maddr == 0 )
> {
> unmap_vtd_domain_page(root_entries);
> @@ -271,7 +272,9 @@ static u64 addr_to_dma_page_maddr(struct
> */
> pdev = pci_get_pdev_by_domain(domain, -1, -1, -1);
> drhd = acpi_find_matched_drhd_unit(pdev);
> - if ( !alloc || ((hd->arch.pgd_maddr = alloc_pgtable_maddr(drhd, 1)) == 0) )
> + if ( !alloc ||
> + ((hd->arch.pgd_maddr = alloc_pgtable_maddr(drhd, 1,
> + domain)) == 0) )
This allocation should be based on the proximity information of the
iommu, not of the requesting domain.
> goto out;
> }
>
> @@ -289,7 +292,7 @@ static u64 addr_to_dma_page_maddr(struct
>
> pdev = pci_get_pdev_by_domain(domain, -1, -1, -1);
> drhd = acpi_find_matched_drhd_unit(pdev);
> - pte_maddr = alloc_pgtable_maddr(drhd, 1);
> + pte_maddr = alloc_pgtable_maddr(drhd, 1, domain);
As should this.
I don't see a need to extend the prototype of alloc_pgtable_maddr().
The drhd parameter contains all relevant information concerning proximity.
~Andrew
> if ( !pte_maddr )
> break;
>
> @@ -1119,7 +1122,7 @@ int __init iommu_alloc(struct acpi_drhd_
> iommu->intel->drhd = drhd;
> drhd->iommu = iommu;
>
> - if ( !(iommu->root_maddr = alloc_pgtable_maddr(drhd, 1)) )
> + if ( !(iommu->root_maddr = alloc_pgtable_maddr(drhd, 1, NULL)) )
> return -ENOMEM;
>
> iommu->reg = ioremap(drhd->address, PAGE_SIZE);
> @@ -1270,7 +1273,7 @@ int domain_context_mapping_one(
>
> ASSERT(spin_is_locked(&pcidevs_lock));
> spin_lock(&iommu->lock);
> - maddr = bus_to_context_maddr(iommu, bus);
> + maddr = bus_to_context_maddr(iommu, bus, domain);
> context_entries = (struct context_entry *)map_vtd_domain_page(maddr);
> context = &context_entries[devfn];
>
> @@ -1495,7 +1498,7 @@ int domain_context_unmap_one(
> ASSERT(spin_is_locked(&pcidevs_lock));
> spin_lock(&iommu->lock);
>
> - maddr = bus_to_context_maddr(iommu, bus);
> + maddr = bus_to_context_maddr(iommu, bus, domain);
> context_entries = (struct context_entry *)map_vtd_domain_page(maddr);
> context = &context_entries[devfn];
>
> --- a/xen/drivers/passthrough/vtd/qinval.c
> +++ b/xen/drivers/passthrough/vtd/qinval.c
> @@ -374,7 +374,8 @@ int enable_qinval(struct iommu *iommu)
> if ( qi_ctrl->qinval_maddr == 0 )
> {
> drhd = iommu_to_drhd(iommu);
> - qi_ctrl->qinval_maddr = alloc_pgtable_maddr(drhd, QINVAL_ARCH_PAGE_NR);
> + qi_ctrl->qinval_maddr = alloc_pgtable_maddr(drhd, QINVAL_ARCH_PAGE_NR,
> + NULL);
> if ( qi_ctrl->qinval_maddr == 0 )
> {
> dprintk(XENLOG_WARNING VTDPREFIX,
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 7232 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-03-05 17:28 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 13:44 [PATCH 0/5] (not just)x86/Dom0: NUMA related adjustments Jan Beulich
2015-02-26 13:52 ` [PATCH 1/5] x86: allow specifying the NUMA nodes Dom0 should run on Jan Beulich
2015-02-26 17:14 ` Dario Faggioli
2015-02-27 8:46 ` Jan Beulich
2015-02-27 10:04 ` Dario Faggioli
2015-02-27 10:50 ` Jan Beulich
2015-02-27 14:54 ` Dario Faggioli
2015-02-27 15:04 ` Jan Beulich
2015-03-03 10:51 ` Jan Beulich
2015-03-04 10:18 ` Dario Faggioli
2015-03-06 9:11 ` Jan Beulich
2015-03-06 10:46 ` Dario Faggioli
2015-03-06 11:33 ` Dario Faggioli
2015-03-06 13:26 ` Jan Beulich
2015-03-06 11:49 ` Jan Beulich
2015-03-03 9:59 ` Ian Campbell
2015-03-05 16:11 ` Andrew Cooper
2015-03-05 16:43 ` Jan Beulich
2015-03-05 17:27 ` Andrew Cooper
2015-03-06 9:19 ` [PATCH 1/5 v2] " Jan Beulich
2015-03-06 10:41 ` Dario Faggioli
2015-03-06 16:05 ` Andrew Cooper
2015-02-26 13:53 ` [PATCH 2/5] allow domain heap allocations to specify more than one NUMA node Jan Beulich
2015-02-27 11:34 ` Dario Faggioli
2015-03-02 17:12 ` Ian Campbell
2015-03-03 7:59 ` Jan Beulich
2015-03-05 16:18 ` Andrew Cooper
2015-02-26 13:54 ` [PATCH 3/5] x86: widen NUMA nodes to be allocated from Jan Beulich
2015-02-27 13:27 ` Dario Faggioli
2015-02-27 13:36 ` Jan Beulich
2015-02-27 14:11 ` Dario Faggioli
2015-02-27 13:38 ` Julien Grall
2015-02-27 13:55 ` Dario Faggioli
2015-02-27 13:58 ` Jan Beulich
2015-02-27 13:46 ` Ian Campbell
2015-02-27 14:00 ` Dario Faggioli
2015-02-27 14:03 ` Jan Beulich
2015-03-05 16:39 ` Andrew Cooper
2015-02-26 13:55 ` [PATCH 4/5] VT-d: " Jan Beulich
2015-03-05 17:08 ` Andrew Cooper [this message]
2015-03-09 3:07 ` Tian, Kevin
2015-02-26 13:56 ` [PATCH 5/5] AMD IOMMU: " Jan Beulich
2015-03-05 17:30 ` Andrew Cooper
2015-03-06 7:50 ` Jan Beulich
2015-03-06 12:15 ` Andrew Cooper
2015-03-09 15:42 ` Suravee Suthikulanit
2015-03-09 17:26 ` Andrew Cooper
2015-03-09 19:02 ` Suravee Suthikulanit
2015-03-10 7:35 ` Jan Beulich
2015-03-10 13:55 ` Boris Ostrovsky
2015-02-27 10:04 ` [PATCH 0/5] (not just)x86/Dom0: NUMA related adjustments Dario Faggioli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54F88D8F.7050908@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=dario.faggioli@citrix.com \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xenproject.org \
--cc=yang.z.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.