All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	jbeulich@suse.com, keir@xen.org, ian.jackson@eu.citrix.com,
	stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com,
	wei.liu2@citrix.com
Cc: dario.faggioli@citrix.com, ufimtseva@gmail.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 1/4] pci: Do not ignore device's PXM information
Date: Wed, 3 Dec 2014 15:01:32 +0000	[thread overview]
Message-ID: <547F25CC.80200@citrix.com> (raw)
In-Reply-To: <1417556050-23364-2-git-send-email-boris.ostrovsky@oracle.com>

On 02/12/14 21:34, Boris Ostrovsky wrote:
> If ACPI provides PXM data for IO devices then dom0 will pass it to
> hypervisor during PHYSDEVOP_pci_device_add call. This information,
> however, is currently ignored.
>
> We should remember it (in the form of nodeID). We will also print it
> when user requests device information dump.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
>  xen/arch/x86/physdev.c        | 20 +++++++++++++++++---
>  xen/drivers/passthrough/pci.c | 13 +++++++++----
>  xen/include/xen/pci.h         |  5 ++++-
>  3 files changed, 30 insertions(+), 8 deletions(-)
>
> diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
> index 6b3201b..7775f80 100644
> --- a/xen/arch/x86/physdev.c
> +++ b/xen/arch/x86/physdev.c
> @@ -565,7 +565,8 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
>              break;
>  
> -        ret = pci_add_device(0, manage_pci.bus, manage_pci.devfn, NULL);
> +        ret = pci_add_device(0, manage_pci.bus, manage_pci.devfn,
> +                             NULL, NUMA_NO_NODE);
>          break;
>      }
>  
> @@ -597,13 +598,14 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn;
>          ret = pci_add_device(0, manage_pci_ext.bus,
>                               manage_pci_ext.devfn,
> -                             &pdev_info);
> +                             &pdev_info, NUMA_NO_NODE);
>          break;
>      }
>  
>      case PHYSDEVOP_pci_device_add: {
>          struct physdev_pci_device_add add;
>          struct pci_dev_info pdev_info;
> +        int node;
>  
>          ret = -EFAULT;
>          if ( copy_from_guest(&add, arg, 1) != 0 )
> @@ -618,7 +620,19 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          }
>          else
>              pdev_info.is_virtfn = 0;
> -        ret = pci_add_device(add.seg, add.bus, add.devfn, &pdev_info);
> +
> +        if ( add.flags & XEN_PCI_DEV_PXM ) {
> +            int optarr_off = offsetof(struct physdev_pci_device_add, optarr) /
> +                             sizeof(add.optarr[0]);
> +
> +            if ( copy_from_guest_offset(&add.optarr[0], arg, optarr_off, 1) )
> +                break;

This will clobber the hypervisor stack, attempting to put the PXM
information into what is probably pdev_info.

How is one expected to use XEN_PCI_DEV_PXM ? There is currently no
specification of how to use the variable length structure.

~Andrew

  reply	other threads:[~2014-12-03 15:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 21:34 [PATCH 0/4] Display IO topology when PXM data is available Boris Ostrovsky
2014-12-02 21:34 ` [PATCH 1/4] pci: Do not ignore device's PXM information Boris Ostrovsky
2014-12-03 15:01   ` Andrew Cooper [this message]
2014-12-03 15:19     ` Boris Ostrovsky
2014-12-05 15:53   ` Jan Beulich
2014-12-05 17:02     ` Boris Ostrovsky
2014-12-02 21:34 ` [PATCH 2/4] sysctl/libxl: Add interface for returning IO topology data Boris Ostrovsky
2014-12-03 15:20   ` Andrew Cooper
2014-12-03 15:37     ` Boris Ostrovsky
2014-12-04 11:24   ` Wei Liu
2014-12-04 11:55   ` Dario Faggioli
2014-12-04 16:26     ` Boris Ostrovsky
2014-12-04 16:44       ` Andrew Cooper
2014-12-04 17:11       ` Jan Beulich
2014-12-05 15:55   ` Jan Beulich
2014-12-05 16:03     ` Jan Beulich
2014-12-05 17:10       ` Boris Ostrovsky
2014-12-08  8:33         ` Jan Beulich
2014-12-08 14:56           ` Boris Ostrovsky
2014-12-08 15:19             ` Jan Beulich
2014-12-08 15:30               ` Andrew Cooper
2014-12-02 21:34 ` [PATCH 3/4] sysctl/libxl: Provide information about IO topology Boris Ostrovsky
2014-12-04 12:22   ` Dario Faggioli
2014-12-04 13:28     ` Ian Campbell
2014-12-05 15:59   ` Jan Beulich
2014-12-02 21:34 ` [PATCH 4/4] libxl: Switch to using new topology interface Boris Ostrovsky

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=547F25CC.80200@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dario.faggioli@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=ufimtseva@gmail.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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.