[Devel] [PATCH] Introduce a handy list_first_entry macro (v2)

2007-04-17 Thread Pavel Emelianov
There are many places in the kernel where the construction like foo = list_entry(head->next, struct foo_struct, list); are used. The code might look more descriptive and neat if using the macro list_first_entry(head, type, member) \ list_entry((head)->next, type, member) Her

[Devel] Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread Pavel Emelianov
[snip] > --- linux-2.6.orig/net/bridge/br_private.h2007-04-17 > 13:26:48.0 -0700 +++ linux-2.6/net/bridge/br_private.h > 2007-04-17 13:30:29.0 -0700 @@ -36,7 +36,7 @@ > { > unsigned char prio[2]; > unsigned char addr[6]; > -}; > +} __attribute__((aligned(8)));

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M (v2)

2007-04-17 Thread Pavel Emelianov
Dave Hansen wrote: > On Tue, 2007-04-17 at 19:34 +0400, Pavel Emelianov wrote: >> +#define SHOW_TOP_SLABS 10 > > Real minor nit on this one: SHOW_TOP_SLABS sounds like a bool. "Should > I show the top slabs?" > > This might be a bit more clear: > > #define TOP_NR_SLABS_TO_SHOW 10 > > or > >

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M (v2)

2007-04-17 Thread Pekka Enberg
On 4/17/07, Pavel Emelianov <[EMAIL PROTECTED]> wrote: The out_of_memory() function and SysRq-M handler call show_mem() to show the current memory usage state. I am still somewhat unhappy about the spinlock, but I don't really have a better suggestion either. Other than that, looks good to me.

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M

2007-04-17 Thread Pekka J Enberg
On Tue, 17 Apr 2007, Eric Dumazet wrote: > This nr_pages should be in struct kmem_list3, not in struct kmem_cache, > or else you defeat NUMA optimizations if touching a field in kmem_cache > at kmem_getpages()/kmem_freepages() time. We already touch ->flags, ->gfpflags, and ->gfporder in kmem_ge

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M (v2)

2007-04-17 Thread Pekka J Enberg
On Tue, 2007-04-17 at 19:34 +0400, Pavel Emelianov wrote: > > +#define SHOW_TOP_SLABS 10 On Tue, 17 Apr 2007, Dave Hansen wrote: > Real minor nit on this one: SHOW_TOP_SLABS sounds like a bool. "Should > I show the top slabs?" > > This might be a bit more clear: > > #define TOP_NR_SLABS_TO_SHO

[Devel] Re: [PATCH] Introduce a handy list_first_entry macro

2007-04-17 Thread Randy Dunlap
On Tue, 17 Apr 2007 15:18:56 +0400 Pavel Emelianov wrote: > There are many places in the kernel where the construction like > >foo = list_entry(head->next, struct foo_struct, list); > > are used. > The code might look more descriptive and neat if using the macro > >list_first_entry(hea

[Devel] Re: [PATCH] Introduce a handy list_first_entry macro

2007-04-17 Thread Zach Brown
On Tue, Apr 17, 2007 at 03:18:56PM +0400, Pavel Emelianov wrote: > There are many places in the kernel where the construction like > >foo = list_entry(head->next, struct foo_struct, list); > > are used. > The code might look more descriptive and neat if using the macro > >list_first_ent

[Devel] Re: [PATCH] Report that kernel is tainted if there were an OOPS before

2007-04-17 Thread Randy Dunlap
On Mon, 16 Apr 2007 14:23:26 +0400 Pavel Emelianov wrote: > If the kernel OOPS-ed or BUG-ed then it probably should > considered as tainted. Use die_counter introduced by many > architectures to determine whether or not the kernel died. > > This saves a lot of time explaining oddities in the > ca

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Ram Pai
On Tue, 2007-04-17 at 21:43 +0200, Miklos Szeredi wrote: > > > > I'm a bit lost about what is currently done and who advocates for what. > > > > > > > > It seems to me the MNT_ALLOWUSERMNT (or whatever :) flag should be > > > > propagated. In the /share rbind+chroot example, I assume the admin >

[Devel] Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread David Miller
From: Eric Dumazet <[EMAIL PROTECTED]> Date: Tue, 17 Apr 2007 23:24:36 +0200 > I suspect you missed part of Stephen patch : > > (maybe some mailer problem...) My bad, sorry :( I pushed the other version of the fix to Linus just now. I'll put Stephen's version in if he sends me a fixup relative

[Devel] Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread Eric Dumazet
David Miller a écrit : From: Stephen Hemminger <[EMAIL PROTECTED]> Date: Tue, 17 Apr 2007 13:37:23 -0700 The previous patch relied on the bridge id being aligned by the compiler (which happens as a side effect). So please use this instead. compare_ether_addr() implicitly requires that the addr

[Devel] Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread David Miller
From: Stephen Hemminger <[EMAIL PROTECTED]> Date: Tue, 17 Apr 2007 13:37:23 -0700 > The previous patch relied on the bridge id being aligned by > the compiler (which happens as a side effect). So please use > this instead. > > compare_ether_addr() implicitly requires that the addresses > passed a

[Devel] Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread Stephen Hemminger
The previous patch relied on the bridge id being aligned by the compiler (which happens as a side effect). So please use this instead. compare_ether_addr() implicitly requires that the addresses passed are 2-bytes aligned in memory. This is not true for br_stp_change_bridge_id() and br_stp_recalc

[Devel] Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread Stephen Hemminger
David Miller wrote: From: Pavel Emelianov <[EMAIL PROTECTED]> Date: Tue, 17 Apr 2007 15:49:30 +0400 From: Evgeny Kravtsunov <[EMAIL PROTECTED]> compare_ether_addr() implicitly requires that the addresses passed are 2-bytes aligned in memory. This is not true for br_stp_change_bridge_id() a

[Devel] Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread David Miller
From: Stephen Hemminger <[EMAIL PROTECTED]> Date: Tue, 17 Apr 2007 12:55:41 -0700 > David Miller wrote: > > From: Pavel Emelianov <[EMAIL PROTECTED]> > > Date: Tue, 17 Apr 2007 15:49:30 +0400 > > > > > >> From: Evgeny Kravtsunov <[EMAIL PROTECTED]> > >> > >> compare_ether_addr() implicitly requ

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Eric W. Biederman
Miklos Szeredi <[EMAIL PROTECTED]> writes: >> > I'm still not sure, what your problem is. >> >> My problem right now is that I see a serious complexity escalation in >> the user interface that we must support indefinitely. >> >> I see us taking a nice powerful concept and seriously watering it d

[Devel] Re: [PATCH] Set a separate lockdep class for neighbour table's proxy_queue

2007-04-17 Thread David Miller
From: Pavel Emelianov <[EMAIL PROTECTED]> Date: Mon, 16 Apr 2007 16:08:25 +0400 > Otherwise the following calltrace will lead to a wrong > lockdep warning: > > neigh_proxy_process() > `- lock(neigh_table->proxy_queue.lock); > arp_redo /* via tbl->proxy_redo */ > arp_process > neigh_ev

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Miklos Szeredi
> > > I'm a bit lost about what is currently done and who advocates for what. > > > > > > It seems to me the MNT_ALLOWUSERMNT (or whatever :) flag should be > > > propagated. In the /share rbind+chroot example, I assume the admin > > > would start by doing > > > > > > mount --bind /share /shar

[Devel] Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread David Miller
From: Pavel Emelianov <[EMAIL PROTECTED]> Date: Tue, 17 Apr 2007 15:49:30 +0400 > From: Evgeny Kravtsunov <[EMAIL PROTECTED]> > > compare_ether_addr() implicitly requires that the addresses > passed are 2-bytes aligned in memory. > > This is not true for br_stp_change_bridge_id() and > br_stp_re

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Ram Pai
On Tue, 2007-04-17 at 19:44 +0200, Miklos Szeredi wrote: > > I'm a bit lost about what is currently done and who advocates for what. > > > > It seems to me the MNT_ALLOWUSERMNT (or whatever :) flag should be > > propagated. In the /share rbind+chroot example, I assume the admin > > would start by

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Miklos Szeredi
> > mount --make-rshared / > > mkdir -p /mnt/ns/$USER > > mount --rbind / /mnt/ns/$USER > > mount --make-rslave /mnt/ns/$USER > > This was my main point - that the tree in which users can mount will be > a slave of /, so that propagating the "are user mounts allowed" flag > among peers is safe and

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M (v2)

2007-04-17 Thread Dave Hansen
On Tue, 2007-04-17 at 19:34 +0400, Pavel Emelianov wrote: > +#define SHOW_TOP_SLABS 10 Real minor nit on this one: SHOW_TOP_SLABS sounds like a bool. "Should I show the top slabs?" This might be a bit more clear: #define TOP_NR_SLABS_TO_SHOW 10 or #define NR_SLABS_TO_SHOW 10 -- Dave _

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Miklos Szeredi
> > I'm still not sure, what your problem is. > > My problem right now is that I see a serious complexity escalation in > the user interface that we must support indefinitely. > > I see us taking a nice powerful concept and seriously watering it down. > To some extent we have to avoid confusing s

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Eric W. Biederman
Miklos Szeredi <[EMAIL PROTECTED]> writes: > I'm still not sure, what your problem is. My problem right now is that I see a serious complexity escalation in the user interface that we must support indefinitely. I see us taking a nice powerful concept and seriously watering it down. To some exten

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Serge E. Hallyn
Quoting Miklos Szeredi ([EMAIL PROTECTED]): > > I'm a bit lost about what is currently done and who advocates for what. > > > > It seems to me the MNT_ALLOWUSERMNT (or whatever :) flag should be > > propagated. In the /share rbind+chroot example, I assume the admin > > would start by doing > > >

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Serge E. Hallyn
Quoting Miklos Szeredi ([EMAIL PROTECTED]): > > > > > > Also for bind-mount and remount operations the flag has to be > > > > > > propagated > > > > > > down its propagation tree. Otherwise a unpriviledged mount in a > > > > > > shared > > > > > > mount wont get reflected in its peers and slaves

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Miklos Szeredi
> I'm a bit lost about what is currently done and who advocates for what. > > It seems to me the MNT_ALLOWUSERMNT (or whatever :) flag should be > propagated. In the /share rbind+chroot example, I assume the admin > would start by doing > > mount --bind /share /share > mount --make-s

[Devel] Re: [patch 05/10] Add "permit user submounts" flag to vfsmount

2007-04-17 Thread Serge E. Hallyn
Quoting Miklos Szeredi ([EMAIL PROTECTED]): > > > > MNT_USER and MNT_USERMNT? I claim no way will people keep those > > > > straight. How about MNT_ALLOWUSER and MNT_USER? > > > > > > Umm, is "allowuser" more clear than "usermnt"? What is allowed to the > > > > I think so, yes. One makes it c

[Devel] [PATCH] Show slab memory usage on OOM and SysRq-M (v2)

2007-04-17 Thread Pavel Emelianov
The out_of_memory() function and SysRq-M handler call show_mem() to show the current memory usage state. This is also helpful to see which slabs are the largest in the system. Thanks Pekka for good idea of how to make it better. The nr_pages is stored on kmem_list3 because: 1. as Eric pointed o

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M

2007-04-17 Thread Pekka Enberg
Hi, On 4/17/07, Pavel Emelianov <[EMAIL PROTECTED]> wrote: The out_of_memory() function and SysRq-M handler call show_mem() to show the current memory usage state. This is also helpful to see which slabs are the largest in the system. Makes sense. On 4/17/07, Pavel Emelianov <[EMAIL PROTECTE

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M

2007-04-17 Thread Eric Dumazet
On Tue, 17 Apr 2007 16:22:48 +0300 "Pekka Enberg" <[EMAIL PROTECTED]> wrote: > Hi, > > On 4/17/07, Pavel Emelianov <[EMAIL PROTECTED]> wrote: > > +static unsigned long get_cache_size(struct kmem_cache *cachep) > > +{ > > + unsigned long slabs; > > + struct kmem_list3 *l3; > > +

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M

2007-04-17 Thread Pekka J Enberg
Hi Pavel, At some point in time, I wrote: > > So, now we have two locks protecting cache_chain? Please explain why > > you can't use the mutex. On Tue, 17 Apr 2007, Pavel Emelianov wrote: > Because OOM can actually happen with this mutex locked. For example > kmem_cache_create() locks it and call

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Serge E. Hallyn
Quoting Eric W. Biederman ([EMAIL PROTECTED]): > "Serge E. Hallyn" <[EMAIL PROTECTED]> writes: > >> > >> Why are directory permissions not sufficient to allow/deny non-priveleged > > mounts? > >> I don't understand that contention yet. > > > > The same scenarios laid out previously in this thread.

[Devel] Re: [patch 05/10] Add "permit user submounts" flag to vfsmount

2007-04-17 Thread Serge E. Hallyn
Quoting Miklos Szeredi ([EMAIL PROTECTED]): > > > From: Miklos Szeredi <[EMAIL PROTECTED]> > > > > > > If MNT_USERMNT flag is not set in the target vfsmount, then > > > > MNT_USER and MNT_USERMNT? I claim no way will people keep those > > straight. How about MNT_ALLOWUSER and MNT_USER? > > Umm

[Devel] Re: [PATCH] Introduce a handy list_first_entry macro

2007-04-17 Thread Andi Kleen
Pavel Emelianov <[EMAIL PROTECTED]> writes: > There are many places in the kernel where the construction like > >foo = list_entry(head->next, struct foo_struct, list); > > are used. > The code might look more descriptive and neat if using the macro > >list_first_entry(head, type, membe

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Serge E. Hallyn
Quoting Eric W. Biederman ([EMAIL PROTECTED]): > "Serge E. Hallyn" <[EMAIL PROTECTED]> writes: > >> > >> Why are directory permissions not sufficient to allow/deny non-priveleged > > mounts? > >> I don't understand that contention yet. > > > > The same scenarios laid out previously in this thread.

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M

2007-04-17 Thread Pavel Emelianov
Pekka J Enberg wrote: > Hi Pavel, > > At some point in time, I wrote: >>> So, now we have two locks protecting cache_chain? Please explain why >>> you can't use the mutex. > > On Tue, 17 Apr 2007, Pavel Emelianov wrote: >> Because OOM can actually happen with this mutex locked. For example >> kme

[Devel] Re: [PATCH] Show slab memory usage on OOM and SysRq-M

2007-04-17 Thread Pavel Emelianov
Pekka Enberg wrote: > Hi, > > On 4/17/07, Pavel Emelianov <[EMAIL PROTECTED]> wrote: >> The out_of_memory() function and SysRq-M handler call >> show_mem() to show the current memory usage state. >> >> This is also helpful to see which slabs are the largest >> in the system. > > Makes sense. Tha

[Devel] [PATCH] Show slab memory usage on OOM and SysRq-M

2007-04-17 Thread Pavel Emelianov
The out_of_memory() function and SysRq-M handler call show_mem() to show the current memory usage state. This is also helpful to see which slabs are the largest in the system. Signed-off-by: Pavel Emelianov <[EMAIL PROTECTED]> Signed-off-by: Kirill Korotaev <[EMAIL PROTECTED]> --- diff --git a/

[Devel] Re: [patch 05/10] Add "permit user submounts" flag to vfsmount

2007-04-17 Thread Miklos Szeredi
> > > MNT_USER and MNT_USERMNT? I claim no way will people keep those > > > straight. How about MNT_ALLOWUSER and MNT_USER? > > > > Umm, is "allowuser" more clear than "usermnt"? What is allowed to the > > I think so, yes. One makes it clear that we're talking about allowing > user (something

[Devel] [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses

2007-04-17 Thread Pavel Emelianov
From: Evgeny Kravtsunov <[EMAIL PROTECTED]> compare_ether_addr() implicitly requires that the addresses passed are 2-bytes aligned in memory. This is not true for br_stp_change_bridge_id() and br_stp_recalculate_bridge_id() in which one of the addresses is unsigned char *, and thus may not be 2-b

[Devel] [PATCH] Introduce a handy list_first_entry macro

2007-04-17 Thread Pavel Emelianov
There are many places in the kernel where the construction like foo = list_entry(head->next, struct foo_struct, list); are used. The code might look more descriptive and neat if using the macro list_first_entry(head, type, member) \ list_entry((head)->next, type, member) Her

[Devel] Re: utrace, RCU and ia64

2007-04-17 Thread Alexey Dobriyan
[double freeing of struct utrace leading to oops in __rcu_process_callbacks] Hi, Roland, utrace debugging you've put into 2.6.21-rc6-mm1 helped. Two double-frees reproduced: 1) BUG at kernel/utrace.c:176 rcu_utrace_free utrace_reap utrace_release_task release_task

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Miklos Szeredi
> Interesting > > So far even today these things can happen, however they are sufficiently > unlikely the tools don't account for them. > > Once a hostile user can cause them things are more of a problem. > > > (Unless you want to tackle each problem legacy tool one at a time to > > remove p

[Devel] Re: [patch 05/10] Add "permit user submounts" flag to vfsmount

2007-04-17 Thread Miklos Szeredi
> > From: Miklos Szeredi <[EMAIL PROTECTED]> > > > > If MNT_USERMNT flag is not set in the target vfsmount, then > > MNT_USER and MNT_USERMNT? I claim no way will people keep those > straight. How about MNT_ALLOWUSER and MNT_USER? Umm, is "allowuser" more clear than "usermnt"? What is allowed

Re: [Devel] Re: [patch 05/10] add "permit user mounts in new namespace" clone flag

2007-04-17 Thread Eric W. Biederman
"Serge E. Hallyn" <[EMAIL PROTECTED]> writes: >> >> Why are directory permissions not sufficient to allow/deny non-priveleged > mounts? >> I don't understand that contention yet. > > The same scenarios laid out previously in this thread. I.e. > > 1. user hallyn does mount --bind / /home/hallyn/ro

[Devel] [PATCH] Report that kernel is tainted if there were an OOPS before (v2)

2007-04-17 Thread Pavel Emelianov
If the kernel OOPS-ed or BUG-ed then it probably should considered as tainted. Use die_counter introduced by many architectures to determine whether or not the kernel died. This saves a lot of time explaining oddities in the calltrace seen via SysRq-P. Signed-off-by: Pavel Emelianov <[EMAIL PROTE

[Devel] Re: How to query mount propagation state?

2007-04-17 Thread Ram Pai
On Mon, 2007-04-16 at 23:07 +0200, Karel Zak wrote: > On Mon, Apr 16, 2007 at 10:39:46AM -0700, Ram Pai wrote: > > > This patch disambiguates multiple mount-instances of the same > > filesystem (or part of the same filesystem), by introducing a new > > interface /proc/mounts_new. The interface has