From: "Jan Beulich" Subject: Re: [PATCH 3/4] sysctl/libxl: Provide information about IO topology Date: Fri, 05 Dec 2014 15:59:17 +0000 Message-ID: <5481E465020000780004D46D@mail.emea.novell.com> References: <1417556050-23364-1-git-send-email-boris.ostrovsky@oracle.com> <1417556050-23364-4-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1417556050-23364-4-git-send-email-boris.ostrovsky@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, ufimtseva@gmail.com, keir@xen.org List-Id: xen-devel@lists.xenproject.org >>> On 02.12.14 at 22:34, wrote: > @@ -362,6 +363,35 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) > u.topologyinfo.max_cpu_index) ) > ret = -EFAULT; > } > + > + if ( !ret && !guest_handle_is_null(ti->iotopo) ) > + { > + for ( i = 0; i < ti->max_devs; i++ ) Careful about long running loops here please. Jan > + { > + xen_sysctl_iotopo_t iotopo; > + struct pci_dev *pdev; > + > + if ( copy_from_guest_offset(&iotopo, ti->iotopo, i, 1) ) > + { > + ret = -EFAULT; > + break; > + } > + > + spin_lock(&pcidevs_lock); > + pdev = pci_get_pdev(iotopo.seg, iotopo.bus, iotopo.devfn); > + if ( !pdev || (pdev->node == NUMA_NO_NODE) ) > + iotopo.node = INVALID_TOPOLOGY_ID; > + else > + iotopo.node = pdev->node; > + spin_unlock(&pcidevs_lock); > + > + if ( copy_to_guest_offset(ti->iotopo, i, &iotopo, 1) ) > + { > + ret = -EFAULT; > + break; > + } > + } > + } > } > break; > > -- > 1.8.4.2