Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] stmmac: fix stmmac_resume removing not yet used shutdown flag
From: Vlad Lungu @ 2010-11-29 10:32 UTC (permalink / raw)
  To: Peppe CAVALLARO; +Cc: netdev@vger.kernel.org, David S. Miller
In-Reply-To: <4CEFC14B.70806@st.com>

Peppe CAVALLARO wrote:
> On 11/26/2010 3:11 PM, Peppe CAVALLARO wrote:
>> The commit to convert to use the dev_pm_ops struct
>> introduces a bug. The shutdown flag is not yet used
>> because the hibernation on memory is done by using
>> the freeze callback.
>> Thanks to Vlad for having reported it.
> Hi Vlad,
> as we discussed via email, I'll also look at how to manage the
> patch that reworked the private structure and that's generating
> problems on your HW (I'll also try to have it for testing!).
> 

Actually, this is is not a blocking problem. I can kmalloc a platform
info structure and fill it with the relevant data on probe. It just feels ... wrong.

The way I see it, the platform info is similar to the PNP on an ISA bus or
the PCI header of a device. Having platform info for a PCI device is kind of
a hack. You didn't know that there's a PCI device out there and that someone
wants to submit a patch for it, so it probably made sense at the time to rework
the structure that particular way.

Regards,
Vlad




^ permalink raw reply

* [PATCH] sctp: kill unused macros in head file
From: Shan Wei @ 2010-11-29 10:14 UTC (permalink / raw)
  To: Vlad Yasevich, David Miller, shemminger
  Cc: Network-Maillist, SCTP-Maillist, Shan Wei


1. SCTP_CMD_NUM_VERBS,SCTP_CMD_MAX
These two macros have never been used for several years since v2.6.12-rc2.

2.sctp_port_rover,sctp_port_alloc_lock
The commit 063930 abandoned global variables of port_rover and port_alloc_lock,
but still keep two macros to refer to them.
So, remove them now.

commit 06393009000779b00a558fd2f280882cc7dc2008
Author: Stephen Hemminger <shemminger@linux-foundation.org>
Date:   Wed Oct 10 17:30:18 2007 -0700

    [SCTP]: port randomization


Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
 include/net/sctp/command.h |    3 ---
 include/net/sctp/structs.h |    2 --
 2 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 2c55a7e..c01dc99 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -111,9 +111,6 @@ typedef enum {
 	SCTP_CMD_LAST
 } sctp_verb_t;
 
-#define SCTP_CMD_MAX		(SCTP_CMD_LAST - 1)
-#define SCTP_CMD_NUM_VERBS	(SCTP_CMD_MAX + 1)
-
 /* How many commands can you put in an sctp_cmd_seq_t?
  * This is a rather arbitrary number, ideally derived from a careful
  * analysis of the state functions, but in reality just taken from
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 69fef4f..cc9185c 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -261,8 +261,6 @@ extern struct sctp_globals {
 #define sctp_assoc_hashsize		(sctp_globals.assoc_hashsize)
 #define sctp_assoc_hashtable		(sctp_globals.assoc_hashtable)
 #define sctp_port_hashsize		(sctp_globals.port_hashsize)
-#define sctp_port_rover			(sctp_globals.port_rover)
-#define sctp_port_alloc_lock		(sctp_globals.port_alloc_lock)
 #define sctp_port_hashtable		(sctp_globals.port_hashtable)
 #define sctp_local_addr_list		(sctp_globals.local_addr_list)
 #define sctp_local_addr_lock		(sctp_globals.addr_list_lock)
-- 
1.6.3.3



^ permalink raw reply related

* Re: [PATCH v2] add netdev led trigger
From: Andi Kleen @ 2010-11-29 10:15 UTC (permalink / raw)
  To: Eric Cooper; +Cc: linux-kernel, linux-doc, Richard Purdie, Randy Dunlap, netdev
In-Reply-To: <1290998056-8310-1-git-send-email-ecc@cmu.edu>

Eric Cooper <ecc@cmu.edu> writes:

> Add a netdev LED trigger for all Blinkenlights lovers...
> Originally taken from https://dev.openwrt.org/ticket/2776
> Slightly updated for 2.6.24 by Mickey Lauer <mickey@openmoko.org>
> and for 2.6.36 by Eric Cooper <ecc@cmu.edu>

You should really send this to netdev too.

Some comments:

The timer seems power unfriendly -- it will always tick even if nothing 
happens.

Using the device name as an identifier is not reliable, they may 
not be unique.

rwlocks are deprecated.

your store code has a off by one I think, it's possible to put 
not 0 terminated data in the string.


-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply

* Re: [PATCH net-next-2.6 01/19 v5] can: EG20T PCH: Separate Interface Register(IF1/IF2)
From: Marc Kleine-Budde @ 2010-11-29 10:08 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: andrew.chih.howe.khor-ral2JQCrhuEAvxtiuMwx3w, Samuel Ortiz,
	margie.foster-ral2JQCrhuEAvxtiuMwx3w,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
	socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w,
	joel.clark-ral2JQCrhuEAvxtiuMwx3w, qi.wang-ral2JQCrhuEAvxtiuMwx3w,
	David S. Miller, Christian Pellegrin, Wolfgang Grandegger
In-Reply-To: <001501cb8faa$3cc7f220$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 680 bytes --]

On 11/29/2010 10:46 AM, Tomoya MORINAGA wrote:
> On Monday, November 29, 2010 6:22 PM, Marc Kleine-Budde wrote :
> 
>> Maybe your patch description in git commit is unusual. It should be a
>> one line patch subject, followed by a blank line, then a multi line
>> patch description. 
> Adding blank line below subject line, I could confirm 
> whitespace is not inserted.

\o/

regards,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 188 bytes --]

_______________________________________________
Socketcan-core mailing list
Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-core

^ permalink raw reply

* Re: [PATCH net-next-2.6 01/19 v5] can: EG20T PCH: Separate Interface Register(IF1/IF2)
From: Tomoya MORINAGA @ 2010-11-29  9:46 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: andrew.chih.howe.khor-ral2JQCrhuEAvxtiuMwx3w, Samuel Ortiz,
	margie.foster-ral2JQCrhuEAvxtiuMwx3w,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
	socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w,
	joel.clark-ral2JQCrhuEAvxtiuMwx3w, qi.wang-ral2JQCrhuEAvxtiuMwx3w,
	David S. Miller, Christian Pellegrin, Wolfgang Grandegger
In-Reply-To: <4CF370D3.7020606@pengutronix.de>

On Monday, November 29, 2010 6:22 PM, Marc Kleine-Budde wrote :

> Maybe your patch description in git commit is unusual. It should be a
> one line patch subject, followed by a blank line, then a multi line
> patch description. 
Adding blank line below subject line, I could confirm 
whitespace is not inserted.
Thank you.

----
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

^ permalink raw reply

* Re: [PATCH] kthread: NUMA aware kthread_create_on_cpu()
From: Eric Dumazet @ 2010-11-29  9:38 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Andrew Morton, linux-kernel, netdev, David Miller, Tejun Heo,
	Rusty Russell
In-Reply-To: <20101129090510.GA15763@basil.fritz.box>

Le lundi 29 novembre 2010 à 10:05 +0100, Andi Kleen a écrit :
> On Mon, Nov 29, 2010 at 12:37:04AM +0100, Eric Dumazet wrote:

> > Hmm, I meant stack (the thing that might be trashed a lot in ksoftirqd),
> > so it is included in struct thread_info
> 
> task_struct is quite hot too. Also your original mail said
> task struct i believe.
> 
> > And got correct stacks. Are you sure we must use PREFERRED ?
> 
> Yes.

I'll respin a patch not using mempolicy but direct node, for both
thread_info and task_struct allocations.

^ permalink raw reply

* Re: [PATCH net-next] bnx2x: Add Nic partitioning mode (57712 devices)
From: Eilon Greenstein @ 2010-11-29  9:33 UTC (permalink / raw)
  To: Matt Domsch
  Cc: Dmitry Kravkov, davem@davemloft.net, netdev@vger.kernel.org,
	narendra_k@dell.com, jordan_hargrave@dell.com
In-Reply-To: <20101129060114.GC29904@auslistsprd01.us.dell.com>

On Sun, 2010-11-28 at 22:01 -0800, Matt Domsch wrote:
> On Mon, Nov 29, 2010 at 12:09:37AM +0200, Dmitry Kravkov wrote:
> > NIC partitioning is another flavor of multi function - having few
> > PCI functions share the same physical port. Unlike the currently
> > supported mode of multi-function which depends on the switch
> > configuration and uses outer-VLAN, the NPAR mode is switch independent
> > and uses the MAC addresses to distribute incoming packets to the different
> > functions. This patch adds the specific HW setting of the NPAR mode
> > and some distinctions between switch dependent (SD) and
> > switch independent (SI) multi-function (MF) modes where the configuration
> > is not the same.
> 
> Just as SR-IOV introduced sysfs pointers between VF and PF devices:
> /sys/bus/pci/devices/pci0000:00/0000:00:09.0/0000:05:00.0/virtfn0 ->  ../0000:05:10.0/
> /sys/bus/pci/devices/pci0000:00/0000:00:09.0/0000:05:10.0/physfn ->   ../0000:05:00.0/
> 
> I would like to see a similar relationship exposed in sysfs for NPAR
> partitions and their respective ports.  This will let biosdevname
> accurately name NPAR devices according to the scheme:
> 
>   pci<slot>#<port>_<virtual function>
> 
> just as it does for SR-IOV devices.  Is there one parent partition
> that the child partitions could point back to, or other way to group
> all the partitions of a single port?

The main difference here is that we are talking about multiple PFs - so
each can be brought up or down independently of the others. So there is
no one master PF that controls the port and once it is brought down, the
port is down too. At any given moment, one of the PFs is acting as the
port master and controls the shared HW - but once this PF is brought
down, another PF is seamlessly taking over.

I think the main difference is that we have real PCI functions and not
virtual ones. On the same PCI bus, we have two physical ports, and 8
physical functions - 4 on each port. I agree that exposing which
functions are using the same port can really help - so I'm open to
suggestions on the "how".

Thanks,
Eilon





^ permalink raw reply

* Re: [PATCH net-next-2.6 01/19 v5] can: EG20T PCH: Separate Interface Register(IF1/IF2)
From: Marc Kleine-Budde @ 2010-11-29  9:22 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: andrew.chih.howe.khor, Samuel Ortiz, margie.foster, netdev,
	Christian Pellegrin, linux-kernel, yong.y.wang, socketcan-core,
	kok.howg.ewe, joel.clark, David S. Miller, Wolfgang Grandegger,
	qi.wang
In-Reply-To: <002201cb8f69$11d30050$66f8800a@maildom.okisemi.com>

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

On 11/29/2010 02:59 AM, Tomoya MORINAGA wrote:
> On Friday, November 26, 2010 7:04 PM, Marc Kleine-Budde wrote:
> 
>>> nitpick: it's unusual to have leading whitespace in the patch description.
> 
>> maybe it's a problem of your mailer.
> I can see the whitespace created patch by "git format-patch"
> I show the head of patch below.
> 
> From e53c63a8ff00c76f165e371511604f374451627b Mon Sep 17 00:00:00 2001
> From: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
> Date: Thu, 18 Nov 2010 09:18:15 +0900
> Subject: [PATCH] CAN : Separate interface register from whole of register structure.
>  CAN register of Intel PCH EG20T has 2 sets of interface register.
>  To reduce whole of code size, separate interface register.
>  As a result, the number of function also can be reduced.
> 
> Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>

Maybe your patch description in git commit is unusual. It should be a
one line patch subject, followed by a blank line, then a multi line
patch description. The a blank line followed by the S-o-b. Have a look
at 15) in Documentation/SubmittingPatches.

> ---
>  drivers/net/can/pch_can.c |  445 ++++++++++++++++++++-------------------------
>  1 files changed, 201 insertions(+), 244 deletions(-)
> 
> .........
> 
> Since I have copied from the patch file directly, whitespace is inserted.
> When next resubmitting, I will delete the whiletespace by hand.

No need for this.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply

* Re: [PATCH] kthread: NUMA aware kthread_create_on_cpu()
From: Andi Kleen @ 2010-11-29  9:05 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Andi Kleen, Andrew Morton, linux-kernel, netdev, David Miller,
	Tejun Heo, Rusty Russell
In-Reply-To: <1290987424.29196.128.camel@edumazet-laptop>

On Mon, Nov 29, 2010 at 12:37:04AM +0100, Eric Dumazet wrote:
> Le lundi 29 novembre 2010 à 00:01 +0100, Andi Kleen a écrit :
> > On Sun, Nov 28, 2010 at 11:51:51PM +0100, Eric Dumazet wrote:
> > > > Also this messes up the policy of the caller process. You really
> > > > need to save/restore it.
> > > 
> > > Well, caller process duty is to create kthreads in a loop.
> > 
> > In this case any other allocations it may do
> >  are still on those
> > nodes.
> 
> As I said, it does only create_kthread() calls, and no "other
> allocations".

Code changes. Your current setup seems fragile (also
the static variable)

> > > > for the stack, so may be a larger patch.
> > > 
> > > I suggest arches that need slab to allocate kthread stacks do the
> > > appropriate changes, because I am not able to make them myself.
> > > 
> > > On x86, we use page allocator only, so NUMA mempolicy is used.
> > 
> > task_struct is always allocated from slab.
> 
> Hmm, I meant stack (the thing that might be trashed a lot in ksoftirqd),
> so it is included in struct thread_info

task_struct is quite hot too. Also your original mail said
task struct i believe.

> And got correct stacks. Are you sure we must use PREFERRED ?

Yes.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply

* Re: [PATCH] kthread: NUMA aware kthread_create_on_cpu()
From: Américo Wang @ 2010-11-29  9:03 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Eric Dumazet, Andrew Morton, linux-kernel, netdev, David Miller,
	Tejun Heo, Rusty Russell
In-Reply-To: <20101128230146.GB12300@basil.fritz.box>

On Mon, Nov 29, 2010 at 12:01:47AM +0100, Andi Kleen wrote:
>
>task_struct is always allocated from slab.
>

IA64 is an exception, it has its own alloc_task_struct()
which is simply __get_free_pages().

^ permalink raw reply

* Re: [PATCH] vhost: correctly set bits of dirty pages
From: Michael S. Tsirkin @ 2010-11-29  8:25 UTC (permalink / raw)
  To: Jason Wang; +Cc: virtualization, netdev, linux-kernel, kvm
In-Reply-To: <20101129081840.GB25496@redhat.com>

On Mon, Nov 29, 2010 at 10:18:40AM +0200, Michael S. Tsirkin wrote:
> On Mon, Nov 29, 2010 at 01:48:20PM +0800, Jason Wang wrote:
> > When counting pages we should increase it by 1 instead of VHOST_PAGE_SIZE,
> > and also make log_write() can correctly process the request across
> > pages with write_address not start at page boundary.
> > 
> > Signed-off-by: Jason Wang <jasowang@redhat.com>
> 
> 
> Thanks, good catch!
> But let's to it in small steps: first, a small patch to fix the bug:
> I think this is equivalent, right?
> 
> Subject: vhost: correctly set bits of dirty pages
> 
> When counting pages we should increase address by 1 instead of
> VHOST_PAGE_SIZE, and also make log_write() can correctly process the
> request across pages with write_address not starting at page boundary.
> 
> Reported-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

And then this on top:


vhost: better variable name in logging

We really store a page offset in write_address,
so rename it write_page to avoid confusion.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

---

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index d0a3552..1a3d3ed 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -884,15 +884,15 @@ static int set_bit_to_user(int nr, void __user *addr)
 static int log_write(void __user *log_base,
 		     u64 write_address, u64 write_length)
 {
+	u64 write_page = write_address / VHOST_PAGE_SIZE
 	int r;
 	if (!write_length)
 		return 0;
 	write_length += write_address % VHOST_PAGE_SIZE;
-	write_address /= VHOST_PAGE_SIZE;
 	for (;;) {
 		u64 base = (u64)(unsigned long)log_base;
-		u64 log = base + write_address / 8;
-		int bit = write_address % 8;
+		u64 log = base + write_page / 8;
+		int bit = write_page % 8;
 		if ((u64)(unsigned long)log != log)
 			return -EFAULT;
 		r = set_bit_to_user(bit, (void __user *)(unsigned long)log);
@@ -901,7 +901,7 @@ static int log_write(void __user *log_base,
 		if (write_length <= VHOST_PAGE_SIZE)
 			break;
 		write_length -= VHOST_PAGE_SIZE;
-		write_address += 1;
+		write_page += 1;
 	}
 	return r;
 }

^ permalink raw reply related

* Re: [PATCH 1/3] net: kill unused macros in head file
From: Shan Wei @ 2010-11-29  8:21 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki
  Cc: David Miller, Network-Maillist, kuznet, pekkas, jmorris,
	Patrick McHardy
In-Reply-To: <1291016563.7802.2.camel@takos>

Hi yoshifuji-san:

YOSHIFUJI Hideaki wrote, at 11/29/2010 03:42 PM:
>>  
>> -#define RETRANS_TIMER	HZ
>> -
>>  #define MAX_RTR_SOLICITATIONS		3
>>  #define RTR_SOLICITATION_INTERVAL	(4*HZ)
>>  
> 
> I think we should use it in net/ipv6/addrconf.c,
> instead of magic number.

Do you mean to replace all HZ in net/ipv6/addrconf.c with RETRANS_TIMER?

HZ is also a macro. And I think HZ is more easier to read than RETRANS_TIMER.


-- 
Best Regards
-----
Shan Wei

^ permalink raw reply

* Re: [PATCH] vhost: correctly set bits of dirty pages
From: Michael S. Tsirkin @ 2010-11-29  8:18 UTC (permalink / raw)
  To: Jason Wang; +Cc: virtualization, netdev, linux-kernel, kvm
In-Reply-To: <20101129054819.24923.26439.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com>

On Mon, Nov 29, 2010 at 01:48:20PM +0800, Jason Wang wrote:
> When counting pages we should increase it by 1 instead of VHOST_PAGE_SIZE,
> and also make log_write() can correctly process the request across
> pages with write_address not start at page boundary.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>


Thanks, good catch!
But let's to it in small steps: first, a small patch to fix the bug:
I think this is equivalent, right?

Subject: vhost: correctly set bits of dirty pages

When counting pages we should increase address by 1 instead of
VHOST_PAGE_SIZE, and also make log_write() can correctly process the
request across pages with write_address not starting at page boundary.

Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

---

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 568eb70..d0a3552 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -887,6 +887,7 @@ static int log_write(void __user *log_base,
 	int r;
 	if (!write_length)
 		return 0;
+	write_length += write_address % VHOST_PAGE_SIZE;
 	write_address /= VHOST_PAGE_SIZE;
 	for (;;) {
 		u64 base = (u64)(unsigned long)log_base;
@@ -900,7 +901,7 @@ static int log_write(void __user *log_base,
 		if (write_length <= VHOST_PAGE_SIZE)
 			break;
 		write_length -= VHOST_PAGE_SIZE;
-		write_address += VHOST_PAGE_SIZE;
+		write_address += 1;
 	}
 	return r;
 }

^ permalink raw reply related

* Re: [PATCH] vhost: fix typos in comment
From: Michael S. Tsirkin @ 2010-11-29  8:05 UTC (permalink / raw)
  To: Jason Wang; +Cc: virtualization, netdev, linux-kernel, kvm
In-Reply-To: <20101129054840.24951.29849.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com>

On Mon, Nov 29, 2010 at 01:48:40PM +0800, Jason Wang wrote:
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Applied, thanks.

> ---
>  drivers/vhost/net.c   |    2 +-
>  drivers/vhost/vhost.h |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index d10da28..14fc189 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -452,7 +452,7 @@ static void handle_rx_mergeable(struct vhost_net *net)
>  			move_iovec_hdr(vq->iov, vq->hdr, vhost_hlen, in);
>  		else
>  			/* Copy the header for use in VIRTIO_NET_F_MRG_RXBUF:
> -			 * needed because sendmsg can modify msg_iov. */
> +			 * needed because recvmsg can modify msg_iov. */
>  			copy_iovec_hdr(vq->iov, vq->hdr, sock_hlen, in);
>  		msg.msg_iovlen = in;
>  		err = sock->ops->recvmsg(NULL, sock, &msg,
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index 073d06a..2af44b7 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -102,7 +102,7 @@ struct vhost_virtqueue {
>  	 * flush the vhost_work instead of synchronize_rcu. Therefore readers do
>  	 * not need to call rcu_read_lock/rcu_read_unlock: the beginning of
>  	 * vhost_work execution acts instead of rcu_read_lock() and the end of
> -	 * vhost_work execution acts instead of rcu_read_lock().
> +	 * vhost_work execution acts instead of rcu_read_unlock().
>  	 * Writers use virtqueue mutex. */
>  	void __rcu *private_data;
>  	/* Log write descriptors */

^ permalink raw reply

* RE: linux-next: Tree for November 26
From: Shreyas Bhatewara @ 2010-11-29  8:03 UTC (permalink / raw)
  To: Zimny Lech, Stephen Rothwell
  Cc: linux-next@vger.kernel.org, LKML, VMware, Inc.,
	netdev@vger.kernel.org, Scott Goldman
In-Reply-To: <AANLkTinJUT=j_P9FSB=GWTLy4Bkr68iWmB2O=5Q3gcT-@mail.gmail.com>

Thanks for reporting.
Thanks to Scott, the fix went in net-next tree, commit number : e9248fbd6b6f7ef1917bfffe998654e40dfb4cfd

->Shreyas

________________________________________
From: Zimny Lech [napohybelskurwysynom2010@gmail.com]
Sent: Saturday, November 27, 2010 12:38 AM
To: Stephen Rothwell
Cc: linux-next@vger.kernel.org; LKML; Shreyas Bhatewara; VMware, Inc.; netdev@vger.kernel.org
Subject: Re: linux-next: Tree for November 26

Ave

2010/11/26 Stephen Rothwell <sfr@canb.auug.org.au>:
> Hi all,
>
> Changes since 20101125:


  CC      drivers/net/vmxnet3/vmxnet3_drv.o
  CC      drivers/net/vmxnet3/vmxnet3_ethtool.o
/home/test/linux-2.6/drivers/net/vmxnet3/vmxnet3_ethtool.c: In
function 'vmxnet3_get_rss_indir':
/home/test/linux-2.6/drivers/net/vmxnet3/vmxnet3_ethtool.c:562:40:
error: 'struct vmxnet3_adapter' has no member named 'rss_conf'
/home/test/linux-2.6/drivers/net/vmxnet3/vmxnet3_ethtool.c: In
function 'vmxnet3_set_rss_indir':
/home/test/linux-2.6/drivers/net/vmxnet3/vmxnet3_ethtool.c:578:40:
error: 'struct vmxnet3_adapter' has no member named 'rss_conf'
make[4]: *** [drivers/net/vmxnet3/vmxnet3_ethtool.o] Error 1
make[3]: *** [drivers/net/vmxnet3] Error 2
make[2]: *** [drivers/net] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2

^ permalink raw reply

* Re: [PATCH 1/3] net: kill unused macros in head file
From: YOSHIFUJI Hideaki @ 2010-11-29  7:42 UTC (permalink / raw)
  To: Shan Wei
  Cc: David Miller, Network-Maillist, kuznet, pekkas, jmorris,
	Patrick McHardy, yoshfuji
In-Reply-To: <4CF34DEC.6090907@cn.fujitsu.com>

2010-11-29 14:53 +0800, Shan Wei wrote:
> These macros have been defined for several years since v2.6.12-rc2(tracing by git),
> but never be used. So remove them.
> 
> 
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
> ---
>  include/net/addrconf.h  |    2 --
>  include/net/ip6_route.h |    1 -
>  include/net/ndisc.h     |    6 ------
>  include/net/snmp.h      |    1 -
>  include/net/sock.h      |    3 ---
>  include/net/tcp.h       |    6 ------
>  6 files changed, 0 insertions(+), 19 deletions(-)
> 
> diff --git a/include/net/addrconf.h b/include/net/addrconf.h
> index a944124..23710aa 100644
> --- a/include/net/addrconf.h
> +++ b/include/net/addrconf.h
> @@ -1,8 +1,6 @@
>  #ifndef _ADDRCONF_H
>  #define _ADDRCONF_H
>  
> -#define RETRANS_TIMER	HZ
> -
>  #define MAX_RTR_SOLICITATIONS		3
>  #define RTR_SOLICITATION_INTERVAL	(4*HZ)
>  

I think we should use it in net/ipv6/addrconf.c,
instead of magic number.

> diff --git a/include/net/ndisc.h b/include/net/ndisc.h
> index 895997b..f134987 100644
> --- a/include/net/ndisc.h
> +++ b/include/net/ndisc.h
> @@ -39,12 +39,6 @@ enum {
>  
>  #define MAX_RTR_SOLICITATION_DELAY	HZ
>  
> -#define ND_REACHABLE_TIME		(30*HZ)
> -#define ND_RETRANS_TIMER		HZ

ditto (in net/ipv6/ndisc.c)

--yoshfuji


^ permalink raw reply

* [PATCH net-next-2.6] xps: add __rcu annotations
From: Eric Dumazet @ 2010-11-29  7:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Tom Herbert

Avoid sparse warnings : add __rcu annotations and use
rcu_dereference_protected() where necessary.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Tom Herbert <therbert@google.com>
---
 include/linux/netdevice.h |    4 ++--
 net/core/net-sysfs.c      |   24 +++++++++++++++---------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9ae4544..4b0c7f3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -622,7 +622,7 @@ struct xps_map {
  */
 struct xps_dev_maps {
 	struct rcu_head rcu;
-	struct xps_map *cpu_map[0];
+	struct xps_map __rcu *cpu_map[0];
 };
 #define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) +		\
     (nr_cpu_ids * sizeof(struct xps_map *)))
@@ -1049,7 +1049,7 @@ struct net_device {
 	spinlock_t		tx_global_lock;
 
 #ifdef CONFIG_XPS
-	struct xps_dev_maps	*xps_maps;
+	struct xps_dev_maps __rcu *xps_maps;
 #endif
 
 	/* These may be needed for future network-power-down code. */
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 99c1129..3ba2103 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -899,6 +899,8 @@ static void xps_dev_maps_release(struct rcu_head *rcu)
 }
 
 static DEFINE_MUTEX(xps_map_mutex);
+#define xmap_dereference(P)		\
+	rcu_dereference_protected((P), lockdep_is_held(&xps_map_mutex))
 
 static ssize_t store_xps_map(struct netdev_queue *queue,
 		      struct netdev_queue_attribute *attribute,
@@ -935,11 +937,12 @@ static ssize_t store_xps_map(struct netdev_queue *queue,
 
 	mutex_lock(&xps_map_mutex);
 
-	dev_maps = dev->xps_maps;
+	dev_maps = xmap_dereference(dev->xps_maps);
 
 	for_each_possible_cpu(cpu) {
-		new_map = map = dev_maps ? dev_maps->cpu_map[cpu] : NULL;
-
+		map = dev_maps ?
+			xmap_dereference(dev_maps->cpu_map[cpu]) : NULL;
+		new_map = map;
 		if (map) {
 			for (pos = 0; pos < map->len; pos++)
 				if (map->queues[pos] == index)
@@ -974,13 +977,14 @@ static ssize_t store_xps_map(struct netdev_queue *queue,
 			else
 				new_map = NULL;
 		}
-		new_dev_maps->cpu_map[cpu] = new_map;
+		RCU_INIT_POINTER(new_dev_maps->cpu_map[cpu], new_map);
 	}
 
 	/* Cleanup old maps */
 	for_each_possible_cpu(cpu) {
-		map = dev_maps ? dev_maps->cpu_map[cpu] : NULL;
-		if (map && new_dev_maps->cpu_map[cpu] != map)
+		map = dev_maps ?
+			xmap_dereference(dev_maps->cpu_map[cpu]) : NULL;
+		if (map && xmap_dereference(new_dev_maps->cpu_map[cpu]) != map)
 			call_rcu(&map->rcu, xps_map_release);
 		if (new_dev_maps->cpu_map[cpu])
 			nonempty = 1;
@@ -1006,7 +1010,9 @@ error:
 
 	if (new_dev_maps)
 		for_each_possible_cpu(i)
-			kfree(new_dev_maps->cpu_map[i]);
+			kfree(rcu_dereference_protected(
+				new_dev_maps->cpu_map[i],
+				1));
 	kfree(new_dev_maps);
 	free_cpumask_var(mask);
 	return -ENOMEM;
@@ -1032,11 +1038,11 @@ static void netdev_queue_release(struct kobject *kobj)
 	index = get_netdev_queue_index(queue);
 
 	mutex_lock(&xps_map_mutex);
-	dev_maps = dev->xps_maps;
+	dev_maps = xmap_dereference(dev->xps_maps);
 
 	if (dev_maps) {
 		for_each_possible_cpu(i) {
-			map  = dev_maps->cpu_map[i];
+			map = xmap_dereference(dev_maps->cpu_map[i]);
 			if (!map)
 				continue;
 



^ permalink raw reply related

* Re: linux-next: build failure after merge of the net tree
From: Peppe CAVALLARO @ 2010-11-29  7:25 UTC (permalink / raw)
  To: David Miller
  Cc: sfr@canb.auug.org.au, netdev@vger.kernel.org,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20101128.181134.104049260.davem@davemloft.net>

On 11/29/2010 3:11 AM, David Miller wrote:
>
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Mon, 29 Nov 2010 11:08:24 +1100
>
> > Hi all,
> >
> > After merging the net tree, today's linux-next build (x86_64
> allmodconfig)
> > failed like this:
> >
> > drivers/net/stmmac/stmmac_main.c: In function 'stmmac_resume':
> > drivers/net/stmmac/stmmac_main.c:1849: error: 'struct stmmac_priv'
> has no member named 'shutdown'
> >
> > Caused by commit 874bd42d24c2a74f5dbd65e81e175982240fecd8 ("stmmac:
> > convert to dev_pm_ops").
> >
>

Yes, this was my fault.

> > I have used the net tree from next-20101126 for today.
>
> I have pushed the following fix which should cure this:
>
> --------------------
> stmmac: fix stmmac_resume removing not yet used shutdown flag
>

The patch, David already applied, fixes this problem.

Peppe

> The commit to convert to use the dev_pm_ops struct
> introduces a bug. The shutdown flag is not yet used
> because the hibernation on memory is done by using
> the freeze callback.
> Thanks to Vlad for having reported it.
>
> Reported-by: Vlad Lungu <vlad.lungu@windriver.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  drivers/net/stmmac/stmmac_main.c |    7 -------
>  1 files changed, 0 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/stmmac/stmmac_main.c
> b/drivers/net/stmmac/stmmac_main.c
> index f1dbc18..730a6fd 100644
> --- a/drivers/net/stmmac/stmmac_main.c
> +++ b/drivers/net/stmmac/stmmac_main.c
> @@ -1846,13 +1846,6 @@ static int stmmac_resume(struct device *dev)
>         if (!netif_running(ndev))
>                 return 0;
>
> -       if (priv->shutdown) {
> -               /* Re-open the interface and re-init the MAC/DMA
> -                  and the rings (i.e. on hibernation stage) */
> -               stmmac_open(dev);
> -               return 0;
> -       }
> -
>         spin_lock(&priv->lock);
>
>         /* Power Down bit, into the PM register, is cleared
> --
> 1.7.3.2
>

^ permalink raw reply

* [PATCH 3/3] tcp: use TCP_BASE_MSS to set basic mss value
From: Shan Wei @ 2010-11-29  6:54 UTC (permalink / raw)
  To: David Miller, jheffner; +Cc: Network-Maillist, Shan Wei

TCP_BASE_MSS initroduced by commit 5d424d5a is defined, but never be used.
So use it to initialise sysctl_tcp_base_mss.

commit 5d424d5a674f782d0659a3b66d951f412901faee
Author: John Heffner <jheffner@psc.edu>
Date:   Mon Mar 20 17:53:41 2006 -0800

    [TCP]: MTU probing

Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
 net/ipv4/tcp_output.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index bb8f547..7f65ce6 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -55,7 +55,7 @@ int sysctl_tcp_workaround_signed_windows __read_mostly = 0;
 int sysctl_tcp_tso_win_divisor __read_mostly = 3;
 
 int sysctl_tcp_mtu_probing __read_mostly = 0;
-int sysctl_tcp_base_mss __read_mostly = 512;
+int sysctl_tcp_base_mss __read_mostly = TCP_BASE_MSS;
 
 /* By default, RFC2861 behavior.  */
 int sysctl_tcp_slow_start_after_idle __read_mostly = 1;
-- 
1.6.3.3

^ permalink raw reply related

* [PATCH 2/3] net: snmp: fix the wrong ICMP_MIB_MAX value
From: Shan Wei @ 2010-11-29  6:53 UTC (permalink / raw)
  To: David Miller; +Cc: Network-Maillist, Shan Wei

__ICMP_MIB_MAX is equal to the total number of icmp mib,
So no need to add 1. This wastes 4/8 bytes memory.


Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
 include/net/snmp.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/include/net/snmp.h b/include/net/snmp.h
index 835c587..762e2ab 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -60,8 +60,7 @@ struct ipstats_mib {
 };
 
 /* ICMP */
-#define ICMP_MIB_MAX	(__ICMP_MIB_MAX + 1)
-
+#define ICMP_MIB_MAX	__ICMP_MIB_MAX
 struct icmp_mib {
 	unsigned long	mibs[ICMP_MIB_MAX];
 };
-- 
1.6.3.3

^ permalink raw reply related

* [PATCH 1/3] net: kill unused macros in head file
From: Shan Wei @ 2010-11-29  6:53 UTC (permalink / raw)
  To: David Miller
  Cc: Network-Maillist, kuznet, pekkas, jmorris,
	yoshfuji@linux-ipv6.org >> YOSHIFUJI Hideaki,
	Patrick McHardy, Shan Wei

These macros have been defined for several years since v2.6.12-rc2(tracing by git),
but never be used. So remove them.


Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
 include/net/addrconf.h  |    2 --
 include/net/ip6_route.h |    1 -
 include/net/ndisc.h     |    6 ------
 include/net/snmp.h      |    1 -
 include/net/sock.h      |    3 ---
 include/net/tcp.h       |    6 ------
 6 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index a944124..23710aa 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -1,8 +1,6 @@
 #ifndef _ADDRCONF_H
 #define _ADDRCONF_H
 
-#define RETRANS_TIMER	HZ
-
 #define MAX_RTR_SOLICITATIONS		3
 #define RTR_SOLICITATION_INTERVAL	(4*HZ)
 
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 278312c..52c0550 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -3,7 +3,6 @@
 
 #define IP6_RT_PRIO_USER	1024
 #define IP6_RT_PRIO_ADDRCONF	256
-#define IP6_RT_PRIO_KERN	512
 
 struct route_info {
 	__u8			type;
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 895997b..f134987 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -39,12 +39,6 @@ enum {
 
 #define MAX_RTR_SOLICITATION_DELAY	HZ
 
-#define ND_REACHABLE_TIME		(30*HZ)
-#define ND_RETRANS_TIMER		HZ
-
-#define ND_MIN_RANDOM_FACTOR		(1/2)
-#define ND_MAX_RANDOM_FACTOR		(3/2)
-
 #ifdef __KERNEL__
 
 #include <linux/compiler.h>
diff --git a/include/net/snmp.h b/include/net/snmp.h
index a0e6180..835c587 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -60,7 +60,6 @@ struct ipstats_mib {
 };
 
 /* ICMP */
-#define ICMP_MIB_DUMMY	__ICMP_MIB_MAX
 #define ICMP_MIB_MAX	(__ICMP_MIB_MAX + 1)
 
 struct icmp_mib {
diff --git a/include/net/sock.h b/include/net/sock.h
index 5557dfb..717cfbf 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -516,9 +516,6 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
 #define sk_nulls_for_each_from(__sk, node) \
 	if (__sk && ({ node = &(__sk)->sk_nulls_node; 1; })) \
 		hlist_nulls_for_each_entry_from(__sk, node, sk_nulls_node)
-#define sk_for_each_continue(__sk, node) \
-	if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
-		hlist_for_each_entry_continue(__sk, node, sk_node)
 #define sk_for_each_safe(__sk, node, tmp, list) \
 	hlist_for_each_entry_safe(__sk, node, tmp, list, sk_node)
 #define sk_for_each_bound(__sk, node, list) \
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e36c874..ea819cc 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -100,12 +100,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
 #define TCP_SYNACK_RETRIES 5	/* number of times to retry passive opening a
 				 * connection: ~180sec is RFC minimum	*/
 
-
-#define TCP_ORPHAN_RETRIES 7	/* number of times to retry on an orphaned
-				 * socket. 7 is ~50sec-16min.
-				 */
-
-
 #define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT
 				  * state, about 60 seconds	*/
 #define TCP_FIN_TIMEOUT	TCP_TIMEWAIT_LEN
-- 
1.6.3.3

^ permalink raw reply related

* Re: [PATCH net-next] bnx2x: Add Nic partitioning mode (57712 devices)
From: Matt Domsch @ 2010-11-29  6:01 UTC (permalink / raw)
  To: Dmitry Kravkov
  Cc: davem, netdev, Eilon Greenstein, narendra_k, jordan_hargrave
In-Reply-To: <1290982177.6066.3.camel@lb-tlvb-dmitry>

On Mon, Nov 29, 2010 at 12:09:37AM +0200, Dmitry Kravkov wrote:
> NIC partitioning is another flavor of multi function - having few
> PCI functions share the same physical port. Unlike the currently
> supported mode of multi-function which depends on the switch
> configuration and uses outer-VLAN, the NPAR mode is switch independent
> and uses the MAC addresses to distribute incoming packets to the different
> functions. This patch adds the specific HW setting of the NPAR mode
> and some distinctions between switch dependent (SD) and
> switch independent (SI) multi-function (MF) modes where the configuration
> is not the same.

Just as SR-IOV introduced sysfs pointers between VF and PF devices:
/sys/bus/pci/devices/pci0000:00/0000:00:09.0/0000:05:00.0/virtfn0 ->  ../0000:05:10.0/
/sys/bus/pci/devices/pci0000:00/0000:00:09.0/0000:05:10.0/physfn ->   ../0000:05:00.0/

I would like to see a similar relationship exposed in sysfs for NPAR
partitions and their respective ports.  This will let biosdevname
accurately name NPAR devices according to the scheme:

  pci<slot>#<port>_<virtual function>

just as it does for SR-IOV devices.  Is there one parent partition
that the child partitions could point back to, or other way to group
all the partitions of a single port?

Thanks,
Matt

-- 
Matt Domsch
Technology Strategist
Dell | Office of the CTO

^ permalink raw reply

* Re: [PATCH 2/2] pch_gbe driver: The wrong of initializer entry
From: David Miller @ 2010-11-29  5:59 UTC (permalink / raw)
  To: toshiharu-linux
  Cc: linux, randy.dunlap, john.linn, ralf, kristoffer, mbizon,
	gregory.v.rose, netdev, linux-kernel, masa-korg, qi.wang,
	yong.y.wang, andrew.chih.howe.khor, joel.clark, margie.foster,
	kok.howg.ewe
In-Reply-To: <001e01cb8f83$31ade9c0$66f8800a@maildom.okisemi.com>

From: "Toshiharu Okada" <toshiharu-linux@dsn.okisemi.com>
Date: Mon, 29 Nov 2010 14:06:23 +0900

> Hi David Miller
> 
> 
> Date: Sat, 27 Nov 2010 17:41:03 -0800 (PST)
> From: "David Miller" <davem@davemloft.net>
>>
>> > The wrong of initializer entry was modified.
>> >
>> > Signed-off-by: Toshiharu Okada <toshiharu-linux@dsn.okisemi.com>
>>
>> How about you give some credit to David Alan Gilbert who made
>> you aware of this issue?
> 
> Credit?
> Does this mean that I add "Singed of by: Dr. David Alan Gilbert
> <linux@trebig.org>" ?
> Is my understanding correct?

You should use "Reported-by: ..."

^ permalink raw reply

* [PATCH] vhost: fix typos in comment
From: Jason Wang @ 2010-11-29  5:48 UTC (permalink / raw)
  To: virtualization, netdev, linux-kernel, kvm, mst

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/net.c   |    2 +-
 drivers/vhost/vhost.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index d10da28..14fc189 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -452,7 +452,7 @@ static void handle_rx_mergeable(struct vhost_net *net)
 			move_iovec_hdr(vq->iov, vq->hdr, vhost_hlen, in);
 		else
 			/* Copy the header for use in VIRTIO_NET_F_MRG_RXBUF:
-			 * needed because sendmsg can modify msg_iov. */
+			 * needed because recvmsg can modify msg_iov. */
 			copy_iovec_hdr(vq->iov, vq->hdr, sock_hlen, in);
 		msg.msg_iovlen = in;
 		err = sock->ops->recvmsg(NULL, sock, &msg,
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 073d06a..2af44b7 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -102,7 +102,7 @@ struct vhost_virtqueue {
 	 * flush the vhost_work instead of synchronize_rcu. Therefore readers do
 	 * not need to call rcu_read_lock/rcu_read_unlock: the beginning of
 	 * vhost_work execution acts instead of rcu_read_lock() and the end of
-	 * vhost_work execution acts instead of rcu_read_lock().
+	 * vhost_work execution acts instead of rcu_read_unlock().
 	 * Writers use virtqueue mutex. */
 	void __rcu *private_data;
 	/* Log write descriptors */

^ permalink raw reply related

* [PATCH] vhost: correctly set bits of dirty pages
From: Jason Wang @ 2010-11-29  5:48 UTC (permalink / raw)
  To: virtualization, netdev, linux-kernel, kvm, mst

When counting pages we should increase it by 1 instead of VHOST_PAGE_SIZE,
and also make log_write() can correctly process the request across
pages with write_address not start at page boundary.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/vhost.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index a29d91c..576300b 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -884,23 +884,21 @@ static int set_bit_to_user(int nr, void __user *addr)
 static int log_write(void __user *log_base,
 		     u64 write_address, u64 write_length)
 {
-	int r;
-	if (!write_length)
-		return 0;
-	write_address /= VHOST_PAGE_SIZE;
-	for (;;) {
+	int r = 0;
+	while (write_length > 0) {
+		u64 l = VHOST_PAGE_SIZE - write_address % VHOST_PAGE_SIZE;
+		u64 write_page = write_address / VHOST_PAGE_SIZE;
 		u64 base = (u64)(unsigned long)log_base;
-		u64 log = base + write_address / 8;
-		int bit = write_address % 8;
+		u64 log = base + write_page / 8;
+		int bit = write_page % 8;
 		if ((u64)(unsigned long)log != log)
 			return -EFAULT;
 		r = set_bit_to_user(bit, (void __user *)(unsigned long)log);
 		if (r < 0)
 			return r;
-		if (write_length <= VHOST_PAGE_SIZE)
-			break;
-		write_length -= VHOST_PAGE_SIZE;
-		write_address += VHOST_PAGE_SIZE;
+		l = min(l, write_length);
+		write_length -= l;
+		write_address += l;
 	}
 	return r;
 }

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox