[patch -resend] xen/privcmd: fix condition in privcmd_close()

2013-05-14 Thread Dan Carpenter
The parenthesis are in the wrong place so the original code is
equivalent to:

if (!xen_feature(0x1)) { ...
Or:
if (!xen_feature(XENFEAT_writable_descriptor_tables)) { ...

Which obviously was not intended.

Signed-off-by: Dan Carpenter 
---
I sent this last November but it was never merged.

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index ca2b00e..2cfc24d 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -504,7 +504,7 @@ static void privcmd_close(struct vm_area_struct *vma)
struct page **pages = vma->vm_private_data;
int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
 
-   if (!xen_feature(XENFEAT_auto_translated_physmap || !numpgs || !pages))
+   if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages)
return;
 
xen_unmap_domain_mfn_range(vma, numpgs, pages);
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: [PATCH] vhost-scsi: Depend on NET for memcpy_fromiovec

2013-05-14 Thread Rusty Russell
Asias He  writes:
> scsi.c includes vhost.c which uses memcpy_fromiovec.
>
> This patch fixes this build failure.
>
>From Randy Dunlap:
>'''
>on x86_64:
>
>ERROR: "memcpy_fromiovec" [drivers/vhost/vhost_scsi.ko] undefined!
>
>It needs to depend on NET since net/core/ provides that function.
>'''

Proper fix please.

Though I can't see why you thought this was a good idea.  Nonetheless, I
shan't highlight why: I have far too much respect for your intellects
and abilities.

No, don't thank me!
Rusty.
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: [PATCH] vhost-scsi: Depend on NET for memcpy_fromiovec

2013-05-14 Thread Asias He
On Tue, May 14, 2013 at 08:10:20PM -0700, Nicholas A. Bellinger wrote:
> On Wed, 2013-05-15 at 08:59 +0800, Asias He wrote:
> > scsi.c includes vhost.c which uses memcpy_fromiovec.
> > 
> > This patch fixes this build failure.
> > 
> >From Randy Dunlap:
> >'''
> >on x86_64:
> > 
> >ERROR: "memcpy_fromiovec" [drivers/vhost/vhost_scsi.ko] undefined!
> > 
> >It needs to depend on NET since net/core/ provides that function.
> >'''
> > 
> > Reported-by: Randy Dunlap 
> > Signed-off-by: Asias He 
> 
> Hey Asias & MST,
> 
> FYI, I'll be sending a PULL request to Linus in the next couple of days
> for -rc2.
> 
> Let me know if you'd like this to be picked up.

Yes, this is 3.10 material. Sounds good to me.

> --nab
> 
> > ---
> >  drivers/vhost/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
> > index 8b9226d..0403323 100644
> > --- a/drivers/vhost/Kconfig
> > +++ b/drivers/vhost/Kconfig
> > @@ -12,7 +12,7 @@ config VHOST_NET
> >  
> >  config VHOST_SCSI
> > tristate "VHOST_SCSI TCM fabric driver"
> > -   depends on TARGET_CORE && EVENTFD && m
> > +   depends on NET && TARGET_CORE && EVENTFD && m
> > select VHOST_RING
> > default n
> > ---help---
> 
> 

-- 
Asias
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: [PATCH] vhost-scsi: Depend on NET for memcpy_fromiovec

2013-05-14 Thread Nicholas A. Bellinger
On Wed, 2013-05-15 at 08:59 +0800, Asias He wrote:
> scsi.c includes vhost.c which uses memcpy_fromiovec.
> 
> This patch fixes this build failure.
> 
>From Randy Dunlap:
>'''
>on x86_64:
> 
>ERROR: "memcpy_fromiovec" [drivers/vhost/vhost_scsi.ko] undefined!
> 
>It needs to depend on NET since net/core/ provides that function.
>'''
> 
> Reported-by: Randy Dunlap 
> Signed-off-by: Asias He 

Hey Asias & MST,

FYI, I'll be sending a PULL request to Linus in the next couple of days
for -rc2.

Let me know if you'd like this to be picked up.

--nab

> ---
>  drivers/vhost/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
> index 8b9226d..0403323 100644
> --- a/drivers/vhost/Kconfig
> +++ b/drivers/vhost/Kconfig
> @@ -12,7 +12,7 @@ config VHOST_NET
>  
>  config VHOST_SCSI
>   tristate "VHOST_SCSI TCM fabric driver"
> - depends on TARGET_CORE && EVENTFD && m
> + depends on NET && TARGET_CORE && EVENTFD && m
>   select VHOST_RING
>   default n
>   ---help---


___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[PATCH] vhost-scsi: Depend on NET for memcpy_fromiovec

2013-05-14 Thread Asias He
scsi.c includes vhost.c which uses memcpy_fromiovec.

This patch fixes this build failure.

   From Randy Dunlap:
   '''
   on x86_64:

   ERROR: "memcpy_fromiovec" [drivers/vhost/vhost_scsi.ko] undefined!

   It needs to depend on NET since net/core/ provides that function.
   '''

Reported-by: Randy Dunlap 
Signed-off-by: Asias He 
---
 drivers/vhost/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
index 8b9226d..0403323 100644
--- a/drivers/vhost/Kconfig
+++ b/drivers/vhost/Kconfig
@@ -12,7 +12,7 @@ config VHOST_NET
 
 config VHOST_SCSI
tristate "VHOST_SCSI TCM fabric driver"
-   depends on TARGET_CORE && EVENTFD && m
+   depends on NET && TARGET_CORE && EVENTFD && m
select VHOST_RING
default n
---help---
-- 
1.8.1.4

___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: linux-next: Tree for May 14 (vhost_scsi)

2013-05-14 Thread Stephen Rothwell
[Adding Michael to cc]

On Tue, 14 May 2013 12:16:20 -0700 Randy Dunlap  wrote:
>
> on x86_64:
> 
> ERROR: "memcpy_fromiovec" [drivers/vhost/vhost_scsi.ko] undefined!
> 
> 
> It needs to depend on NET since net/core/ provides that function.
> 
> -- 
> ~Randy

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpvdkyPDmuF7.pgp
Description: PGP signature
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: linux-next: Tree for May 14 (vhost_scsi)

2013-05-14 Thread Randy Dunlap
On 05/13/13 21:17, Stephen Rothwell wrote:
> Hi all,
> 
> Changes since 20130513:
> 
> 


on x86_64:

ERROR: "memcpy_fromiovec" [drivers/vhost/vhost_scsi.ko] undefined!


It needs to depend on NET since net/core/ provides that function.


-- 
~Randy
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: [RFC PATCH v2, part 2 02/18] PCI, core: use hotplug-safe iterators to walk PCI buses

2013-05-14 Thread Yinghai Lu
On Tue, May 14, 2013 at 9:51 AM, Jiang Liu  wrote:
> Enhance PCI core to use hotplug-safe iterators to walk PCI buses.
>
> In other words, replace pci_find_bus(), pci_find_next_bus() and
> pci_root_buses with pci_bus_exists(), pci_get_bus(), pci_get_next_bus()
> and pci_get_next_root_bus() etc.

good changes.

Acked-by:  Yinghai Lu 
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[RFC PATCH v2, part 2 02/18] PCI, core: use hotplug-safe iterators to walk PCI buses

2013-05-14 Thread Jiang Liu
Enhance PCI core to use hotplug-safe iterators to walk PCI buses.

In other words, replace pci_find_bus(), pci_find_next_bus() and
pci_root_buses with pci_bus_exists(), pci_get_bus(), pci_get_next_bus()
and pci_get_next_root_bus() etc.

Signed-off-by: Jiang Liu 
Cc: Konrad Rzeszutek Wilk 
Cc: Jeremy Fitzhardinge 
Cc: "Rafael J. Wysocki" 
Cc: linux-...@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
Cc: xen-de...@lists.xensource.com
Cc: virtualization@lists.linux-foundation.org
---
 drivers/pci/pci-sysfs.c|  2 +-
 drivers/pci/pcie/pme.c |  5 +++--
 drivers/pci/probe.c| 15 +--
 drivers/pci/setup-bus.c| 14 ++
 drivers/pci/xen-pcifront.c |  3 ++-
 5 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 5b4a9d9..fcc4bb2 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -296,7 +296,7 @@ static ssize_t bus_rescan_store(struct bus_type *bus, const 
char *buf,
 
if (val) {
mutex_lock(&pci_remove_rescan_mutex);
-   while ((b = pci_find_next_bus(b)) != NULL)
+   for_each_pci_root_bus(b)
pci_rescan_bus(b);
mutex_unlock(&pci_remove_rescan_mutex);
}
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
index 795db1f..1ed38a3 100644
--- a/drivers/pci/pcie/pme.c
+++ b/drivers/pci/pcie/pme.c
@@ -132,7 +132,7 @@ static bool pcie_pme_from_pci_bridge(struct pci_bus *bus, 
u8 devfn)
 static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id)
 {
u8 busnr = req_id >> 8, devfn = req_id & 0xff;
-   struct pci_bus *bus;
+   struct pci_bus *bus = NULL;
struct pci_dev *dev;
bool found = false;
 
@@ -161,7 +161,7 @@ static void pcie_pme_handle_request(struct pci_dev *port, 
u16 req_id)
}
 
/* Second, find the bus the source device is on. */
-   bus = pci_find_bus(pci_domain_nr(port->bus), busnr);
+   bus = pci_get_bus(pci_domain_nr(port->bus), busnr);
if (!bus)
goto out;
 
@@ -206,6 +206,7 @@ static void pcie_pme_handle_request(struct pci_dev *port, 
u16 req_id)
}
 
  out:
+   pci_bus_put(bus);
if (!found)
dev_dbg(&port->dev, "Spurious native PME interrupt!\n");
 }
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 6b77333..cc5e432 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -733,7 +733,7 @@ static void pci_fixup_parent_subordinate_busnr(struct 
pci_bus *child, int max)
  */
 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int 
pass)
 {
-   struct pci_bus *child;
+   struct pci_bus *child = NULL;
int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
u32 buses, i, j = 0;
u16 bctl;
@@ -785,7 +785,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev 
*dev, int max, int pass)
 * However, we continue to descend down the hierarchy and
 * scan remaining child buses.
 */
-   child = pci_find_bus(pci_domain_nr(bus), secondary);
+   child = pci_get_bus(pci_domain_nr(bus), secondary);
if (!child) {
child = pci_add_new_bus(bus, dev, secondary);
if (!child)
@@ -793,6 +793,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev 
*dev, int max, int pass)
child->primary = primary;
pci_bus_insert_busn_res(child, secondary, subordinate);
child->bridge_ctl = bctl;
+   pci_bus_get(child);
}
 
cmax = pci_scan_child_bus(child);
@@ -824,12 +825,13 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev 
*dev, int max, int pass)
/* Prevent assigning a bus number that already exists.
 * This can happen when a bridge is hot-plugged, so in
 * this case we only re-scan this bus. */
-   child = pci_find_bus(pci_domain_nr(bus), max+1);
+   child = pci_get_bus(pci_domain_nr(bus), max+1);
if (!child) {
child = pci_add_new_bus(bus, dev, ++max);
if (!child)
goto out;
pci_bus_insert_busn_res(child, max, 0xff);
+   pci_bus_get(child);
}
buses = (buses & 0xff00)
  | ((unsigned int)(child->primary) <<  0)
@@ -874,8 +876,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev 
*dev, int max, int pass)
 */
for (i=0; iparent) {
if ((!pcibios_assign_all_busses()) &&
@@ -930,6 +931,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev 
*dev, int max, int pass)
 
 out:
pci_write_config_word(de

Re: virtio performance analysis

2013-05-14 Thread nitesh narayan lal
I was going through the documentation and I had found that avail_event
is used to set the threshold value after which notification will be
sent. If the kick is required or not will be decide on the basis of
the following condition every time:
(u16)(new_idx - avail_event - 1) < (u16)(new_idx - old_idx)
Right now due to avail_event value the kick is been made for every
start_xmit call,
I wanted to know, how could I modify the avail_event value . So that
the kicks are not made for each start_xmit() call.
Regards
Nitesh Narayan Lal


On Tue, May 14, 2013 at 1:23 PM, Michael S. Tsirkin  wrote:
> On Tue, May 14, 2013 at 11:37:35AM +0530, nitesh narayan lal wrote:
>> I was wondering how exactly vq->event is been set and used?
>> Regards
>> Nitesh Narayan Lal
>>
>>
>> On Tue, May 14, 2013 at 11:37 AM, nitesh narayan lal
>>  wrote:
>> > Hi Michael,
>> > I had seen the virtqueue_kick_prepare() where vring_need_event() is
>> > been used, but somehow for every start_xmit() call vq->event and
>> > need_kick is been set to true.
>> > Due to which for every start_xmit() its kicking via notify() routine.
>> > Regards
>> > Nitesh Narayan Lal
>
>
> vq->event if set when guest and host agree to use event index.
> needs_kick comes from comparison of event index (element for
> which host requested an event) and avail index.
>
> We trigger the event when we make available the element
> for which host requested notification.
>
> More detail in the virtio spec.
>
> --
> MST
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: virtio performance analysis

2013-05-14 Thread Michael S. Tsirkin
On Tue, May 14, 2013 at 11:37:35AM +0530, nitesh narayan lal wrote:
> I was wondering how exactly vq->event is been set and used?
> Regards
> Nitesh Narayan Lal
> 
> 
> On Tue, May 14, 2013 at 11:37 AM, nitesh narayan lal
>  wrote:
> > Hi Michael,
> > I had seen the virtqueue_kick_prepare() where vring_need_event() is
> > been used, but somehow for every start_xmit() call vq->event and
> > need_kick is been set to true.
> > Due to which for every start_xmit() its kicking via notify() routine.
> > Regards
> > Nitesh Narayan Lal


vq->event if set when guest and host agree to use event index.
needs_kick comes from comparison of event index (element for
which host requested an event) and avail index.

We trigger the event when we make available the element
for which host requested notification.

More detail in the virtio spec.

-- 
MST
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization