diff mbox

vhost-scsi: Depend on NET for memcpy_fromiovec

Message ID 1368657450.6899.29.camel@haakon3.risingtidesystems.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nicholas A. Bellinger May 15, 2013, 10:37 p.m. UTC
On Wed, 2013-05-15 at 14:47 +0930, Rusty Russell wrote:
> Asias He <asias@redhat.com> 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!

Hi Rusty & Asias,

I assume you mean something like the following patch to allow kbuild to
work when VHOST_NET + VHOST_SCSI are both enabled and sharing vhost.o,
yes..?

Also included is dropping the now unnecessary vhost.c include, and
allowing vhost_work_flush() to be accessed externally as scsi.c
currently requires.

MST, care to pick this up..?

--nab


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Rusty Russell May 15, 2013, 11:35 p.m. UTC | #1
"Nicholas A. Bellinger" <nab@linux-iscsi.org> writes:
> On Wed, 2013-05-15 at 14:47 +0930, Rusty Russell wrote:
>> Asias He <asias@redhat.com> 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!
>
> Hi Rusty & Asias,
>
> I assume you mean something like the following patch to allow kbuild to
> work when VHOST_NET + VHOST_SCSI are both enabled and sharing vhost.o,
> yes..?

No, that's a separate issue.

memcpy_fromiovec() has nothing to do with networking: that was just the
first user.  Note that crypto/algif_skcipher.c also uses it.  The
obvious answer is to move it into lib/.

OTOH making vhost_scsi depend on CONFIG_NET is breathtakingly lazy.  I
expect better from experienced kernel hackers :(

Rusty.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Asias He May 16, 2013, 1:48 a.m. UTC | #2
On Wed, May 15, 2013 at 03:37:30PM -0700, Nicholas A. Bellinger wrote:
> On Wed, 2013-05-15 at 14:47 +0930, Rusty Russell wrote:
> > Asias He <asias@redhat.com> 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!
> 
> Hi Rusty & Asias,
> 
> I assume you mean something like the following patch to allow kbuild to
> work when VHOST_NET + VHOST_SCSI are both enabled and sharing vhost.o,
> yes..?
> 
> Also included is dropping the now unnecessary vhost.c include, and
> allowing vhost_work_flush() to be accessed externally as scsi.c
> currently requires.
> 
> MST, care to pick this up..?
> 
> --nab


Couple of days ago, I have separated the vhost.ko. 

'vhost: Make vhost a separate module'

http://www.spinics.net/lists/kvm/msg90825.html

MST wanted to queue it up for 3.11. 

> 
> diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
> index 8b9226d..016387f 100644
> --- a/drivers/vhost/Kconfig
> +++ b/drivers/vhost/Kconfig
> @@ -1,3 +1,6 @@
> +config VHOST
> +       tristate
> +
>  config VHOST_NET
>         tristate "Host kernel accelerator for virtio net"
>         depends on NET && EVENTFD && (TUN || !TUN) && (MACVTAP || !MACVTAP)
> @@ -12,7 +15,7 @@ config VHOST_NET
>  
>  config VHOST_SCSI
>         tristate "VHOST_SCSI TCM fabric driver"
> -       depends on TARGET_CORE && EVENTFD && m
> +       depends on NET && EVENTFD && TARGET_CORE
>         select VHOST_RING
>         default n
>         ---help---
> diff --git a/drivers/vhost/Makefile b/drivers/vhost/Makefile
> index 654e9afb..e5b5f0b 100644
> --- a/drivers/vhost/Makefile
> +++ b/drivers/vhost/Makefile
> @@ -1,7 +1,9 @@
> +obj-$(CONFIG_VHOST) += vhost.o
> +
>  obj-$(CONFIG_VHOST_NET) += vhost_net.o
> -vhost_net-y := vhost.o net.o
> +vhost_net-objs := net.o
>  
>  obj-$(CONFIG_VHOST_SCSI) += vhost_scsi.o
> -vhost_scsi-y := scsi.o
> +vhost_scsi-objs := scsi.o
>  
>  obj-$(CONFIG_VHOST_RING) += vringh.o
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 7014202..b5836a2 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -49,7 +49,6 @@
>  #include <linux/llist.h>
>  #include <linux/bitmap.h>
>  
> -#include "vhost.c"
>  #include "vhost.h"
>  
>  #define TCM_VHOST_VERSION  "v0.1"
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index beee7f5..8cd1562 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -123,7 +123,7 @@ static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
>         return left <= 0;
>  }
>  
> -static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work)
> +void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work)
>  {
>         unsigned seq;
>         int flushing;
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index a7ad635..50ee396 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -44,6 +44,7 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
>                      unsigned long mask, struct vhost_dev *dev);
>  int vhost_poll_start(struct vhost_poll *poll, struct file *file);
>  void vhost_poll_stop(struct vhost_poll *poll);
> +void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work);
>  void vhost_poll_flush(struct vhost_poll *poll);
>  void vhost_poll_queue(struct vhost_poll *poll);
> 
>
Asias He May 16, 2013, 2:16 a.m. UTC | #3
On Thu, May 16, 2013 at 09:05:38AM +0930, Rusty Russell wrote:
> "Nicholas A. Bellinger" <nab@linux-iscsi.org> writes:
> > On Wed, 2013-05-15 at 14:47 +0930, Rusty Russell wrote:
> >> Asias He <asias@redhat.com> 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!
> >
> > Hi Rusty & Asias,
> >
> > I assume you mean something like the following patch to allow kbuild to
> > work when VHOST_NET + VHOST_SCSI are both enabled and sharing vhost.o,
> > yes..?
> 
> No, that's a separate issue.
> 
> memcpy_fromiovec() has nothing to do with networking: that was just the
> first user.  Note that crypto/algif_skcipher.c also uses it.  The
> obvious answer is to move it into lib/.

That's true. I also want this.

> OTOH making vhost_scsi depend on CONFIG_NET is breathtakingly lazy.  I
> expect better from experienced kernel hackers :(

But do you think moving the memcpy_fromiovec stuff is a 3.10 material?

> Rusty.
David Miller May 16, 2013, 3:10 a.m. UTC | #4
From: Rusty Russell <rusty@rustcorp.com.au>
Date: Thu, 16 May 2013 09:05:38 +0930

> memcpy_fromiovec() has nothing to do with networking: that was just the
> first user.  Note that crypto/algif_skcipher.c also uses it.  The
> obvious answer is to move it into lib/.

+1
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael S. Tsirkin May 16, 2013, 6:42 a.m. UTC | #5
On Wed, May 15, 2013 at 03:37:30PM -0700, Nicholas A. Bellinger wrote:
> On Wed, 2013-05-15 at 14:47 +0930, Rusty Russell wrote:
> > Asias He <asias@redhat.com> 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!
> 
> Hi Rusty & Asias,
> 
> I assume you mean something like the following patch to allow kbuild to
> work when VHOST_NET + VHOST_SCSI are both enabled and sharing vhost.o,
> yes..?
> 
> Also included is dropping the now unnecessary vhost.c include, and
> allowing vhost_work_flush() to be accessed externally as scsi.c
> currently requires.
> 
> MST, care to pick this up..?
> 
> --nab

We'll do this for 3.11, 3.10 is bugfixes only now.

> diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
> index 8b9226d..016387f 100644
> --- a/drivers/vhost/Kconfig
> +++ b/drivers/vhost/Kconfig
> @@ -1,3 +1,6 @@
> +config VHOST
> +       tristate
> +
>  config VHOST_NET
>         tristate "Host kernel accelerator for virtio net"
>         depends on NET && EVENTFD && (TUN || !TUN) && (MACVTAP || !MACVTAP)
> @@ -12,7 +15,7 @@ config VHOST_NET
>  
>  config VHOST_SCSI
>         tristate "VHOST_SCSI TCM fabric driver"
> -       depends on TARGET_CORE && EVENTFD && m
> +       depends on NET && EVENTFD && TARGET_CORE
>         select VHOST_RING
>         default n
>         ---help---
> diff --git a/drivers/vhost/Makefile b/drivers/vhost/Makefile
> index 654e9afb..e5b5f0b 100644
> --- a/drivers/vhost/Makefile
> +++ b/drivers/vhost/Makefile
> @@ -1,7 +1,9 @@
> +obj-$(CONFIG_VHOST) += vhost.o
> +
>  obj-$(CONFIG_VHOST_NET) += vhost_net.o
> -vhost_net-y := vhost.o net.o
> +vhost_net-objs := net.o
>  
>  obj-$(CONFIG_VHOST_SCSI) += vhost_scsi.o
> -vhost_scsi-y := scsi.o
> +vhost_scsi-objs := scsi.o
>  
>  obj-$(CONFIG_VHOST_RING) += vringh.o
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 7014202..b5836a2 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -49,7 +49,6 @@
>  #include <linux/llist.h>
>  #include <linux/bitmap.h>
>  
> -#include "vhost.c"
>  #include "vhost.h"
>  
>  #define TCM_VHOST_VERSION  "v0.1"
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index beee7f5..8cd1562 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -123,7 +123,7 @@ static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
>         return left <= 0;
>  }
>  
> -static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work)
> +void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work)
>  {
>         unsigned seq;
>         int flushing;
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index a7ad635..50ee396 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -44,6 +44,7 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
>                      unsigned long mask, struct vhost_dev *dev);
>  int vhost_poll_start(struct vhost_poll *poll, struct file *file);
>  void vhost_poll_stop(struct vhost_poll *poll);
> +void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work);
>  void vhost_poll_flush(struct vhost_poll *poll);
>  void vhost_poll_queue(struct vhost_poll *poll);
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael S. Tsirkin May 16, 2013, 6:46 a.m. UTC | #6
On Wed, May 15, 2013 at 08:10:55PM -0700, David Miller wrote:
> From: Rusty Russell <rusty@rustcorp.com.au>
> Date: Thu, 16 May 2013 09:05:38 +0930
> 
> > memcpy_fromiovec() has nothing to do with networking: that was just the
> > first user.  Note that crypto/algif_skcipher.c also uses it.  The
> > obvious answer is to move it into lib/.
> 
> +1

Rusty sent a patch that does this:
http://patchwork.ozlabs.org/patch/244207/

David, looks like you weren't CC'd.
If you agree could you please Ack that patch and then I can merge it
through the vhost tree?
Or if you prefer merge it directly and I'll sort out the dependencies...

Thanks,
David Miller May 16, 2013, 9:10 a.m. UTC | #7
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Thu, 16 May 2013 09:46:21 +0300

> On Wed, May 15, 2013 at 08:10:55PM -0700, David Miller wrote:
>> From: Rusty Russell <rusty@rustcorp.com.au>
>> Date: Thu, 16 May 2013 09:05:38 +0930
>> 
>> > memcpy_fromiovec() has nothing to do with networking: that was just the
>> > first user.  Note that crypto/algif_skcipher.c also uses it.  The
>> > obvious answer is to move it into lib/.
>> 
>> +1
> 
> Rusty sent a patch that does this:
> http://patchwork.ozlabs.org/patch/244207/
> 
> David, looks like you weren't CC'd.
> If you agree could you please Ack that patch and then I can merge it
> through the vhost tree?
> Or if you prefer merge it directly and I'll sort out the dependencies...

Acked-by: David S. Miller <davem@davemloft.net>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
index 8b9226d..016387f 100644
--- a/drivers/vhost/Kconfig
+++ b/drivers/vhost/Kconfig
@@ -1,3 +1,6 @@ 
+config VHOST
+       tristate
+
 config VHOST_NET
        tristate "Host kernel accelerator for virtio net"
        depends on NET && EVENTFD && (TUN || !TUN) && (MACVTAP || !MACVTAP)
@@ -12,7 +15,7 @@  config VHOST_NET
 
 config VHOST_SCSI
        tristate "VHOST_SCSI TCM fabric driver"
-       depends on TARGET_CORE && EVENTFD && m
+       depends on NET && EVENTFD && TARGET_CORE
        select VHOST_RING
        default n
        ---help---
diff --git a/drivers/vhost/Makefile b/drivers/vhost/Makefile
index 654e9afb..e5b5f0b 100644
--- a/drivers/vhost/Makefile
+++ b/drivers/vhost/Makefile
@@ -1,7 +1,9 @@ 
+obj-$(CONFIG_VHOST) += vhost.o
+
 obj-$(CONFIG_VHOST_NET) += vhost_net.o
-vhost_net-y := vhost.o net.o
+vhost_net-objs := net.o
 
 obj-$(CONFIG_VHOST_SCSI) += vhost_scsi.o
-vhost_scsi-y := scsi.o
+vhost_scsi-objs := scsi.o
 
 obj-$(CONFIG_VHOST_RING) += vringh.o
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 7014202..b5836a2 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -49,7 +49,6 @@ 
 #include <linux/llist.h>
 #include <linux/bitmap.h>
 
-#include "vhost.c"
 #include "vhost.h"
 
 #define TCM_VHOST_VERSION  "v0.1"
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index beee7f5..8cd1562 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -123,7 +123,7 @@  static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
        return left <= 0;
 }
 
-static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work)
+void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work)
 {
        unsigned seq;
        int flushing;
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index a7ad635..50ee396 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -44,6 +44,7 @@  void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
                     unsigned long mask, struct vhost_dev *dev);
 int vhost_poll_start(struct vhost_poll *poll, struct file *file);
 void vhost_poll_stop(struct vhost_poll *poll);
+void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work);
 void vhost_poll_flush(struct vhost_poll *poll);
 void vhost_poll_queue(struct vhost_poll *poll);