Re: [patch 0/6] Per cpu structures for SLUB

2007-08-27 Thread Christoph Lameter
On Fri, 24 Aug 2007, Andrew Morton wrote:

> I'm struggling a bit to understand these numbers.  Bigger is better, I
> assume?  In what units are these numbers?

No less is better. These are cycle counts. Hmmm... We discussed these 
cycle counts so much in the last week that I forgot to mention that.

> > Page allocator pass through
> > ---
> > There is a significant difference in the columns marked with a * because
> > of the way that allocations for page sized objects are handled.
> 
> OK, but what happened to the third pair of columns (Concurrent Alloc,
> Kmalloc) for 1024 and 2048-byte allocations?  They seem to have become
> significantly slower?

There is a significant performance increase there. That is the main point 
of the patch.

> Thanks for running the numbers, but it's still a bit hard to work out
> whether these changes are an aggregate benefit?

There is a drawback because of the additional code introduced in the fast 
path. However, the regular kmalloc case shows improvements throughout. 
This is in particular of importance for SMP systems. We see an improvement 
even for 2 processors.

> > If we handle
> > the allocations in the slab allocator (Norm) then the alloc free tests
> > results are superb since we can use the per cpu slab to just pass a pointer
> > back and forth. The page allocator pass through (PCPU) shows that the page
> > allocator may have problems with giving back the same page after a free.
> > Or there something else in the page allocator that creates significant
> > overhead compared to slab. Needs to be checked out I guess.
> > 
> > However, the page allocator pass through is a win in the other cases
> > since we can cut out the page allocator overhead. That is the more typical
> > load of allocating a sequence of objects and we should optimize for that.
> > 
> > (+ = Must be some cache artifact here or code crossing a TLB boundary.
> > The result is reproducable)
> > 
> 
> Most Linux machines are uniprocessor.  We should keep an eye on what effect
> a change like this has on code size and performance for CONFIG_SMP=n
> builds..

There is an #ifdef around ther per cpu structure management code. All of 
this will vanish (including the lookup of the per cpu address from the 
fast path) if SMP is off.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Who wants to maintain KR list for stable releases? (was Re: nmi_watchdog=2 regression in 2.6.21)

2007-08-27 Thread David Rees
On 8/27/07, Daniel Walker <[EMAIL PROTECTED]> wrote:
> Now that I'm looking at the kernel bugzilla .. If you set the kernel
> version to 2.6.22 and set the "Regression" check box you could denote
> the fact that it's a regression in that kernel version ..
>
> I don't know if this URL is going to come out right,
>
> 
>
> That should be open bugs , kernel version 2.6.22, with the regression
> check box set ..
>
> So you may not need a master tracking bug ..

Yep, that's another way to do it. The method I described earlier is
commonly used when you don't have the handy regression field in
bugzilla. The technique is handy for creating lists for tracking other
types of issues which don't necessarily fall into a component and you
don't want to bother customizing bugzilla.

I also suspect that there will be a number of common searches that
many people will find useful. With recent versions of bugzilla (3.0+)
you can share searches within groups, but it may be helpful to have a
wiki or some other page where useful searches can be stored, or one of
the templates edited to include those common searches.

-Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: nfs4 filesystem mounted via the "bind" option reports wrong fstype

2007-08-27 Thread Al Viro
On Mon, Aug 27, 2007 at 02:40:59PM -0400, J. Bruce Fields wrote:
 
> There's no reason not to just mount server:/exports/data directly at
> /home/data; the bind mounts are just a workaround for the somewhat
> primitive exports facility on the server side.

Bullshit.  Bindings are first-class operations on _client_, regardless
of fs types involved.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] sched: fix broken smt/mc optimizations with CFS

2007-08-27 Thread Siddha, Suresh B
On Thu, Aug 23, 2007 at 02:13:41PM +0200, Ingo Molnar wrote:
> 
> * Ingo Molnar <[EMAIL PROTECTED]> wrote:
> 
> > [...] So how about the patch below instead?
> 
> the right patch attached.
> 
> >
> Subject: sched: fix broken SMT/MC optimizations
> From: "Siddha, Suresh B" <[EMAIL PROTECTED]>
> 
> On a four package system with HT - HT load balancing optimizations were
> broken.  For example, if two tasks end up running on two logical threads
> of one of the packages, scheduler is not able to pull one of the tasks
> to a completely idle package.
> 
> In this scenario, for nice-0 tasks, imbalance calculated by scheduler
> will be 512 and find_busiest_queue() will return 0 (as each cpu's load
> is 1024 > imbalance and has only one task running).
> 
> Similarly MC scheduler optimizations also get fixed with this patch.
> 
> [ [EMAIL PROTECTED]: restored fair balancing by increasing the fuzz and
>  adding it back to the power decision, without the /2
>  factor. ]
> 
> Signed-off-by: Suresh Siddha <[EMAIL PROTECTED]>
> Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
> ---
> 
>  include/linux/sched.h |2 +-
>  kernel/sched.c|2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> Index: linux/include/linux/sched.h
> ===
> --- linux.orig/include/linux/sched.h
> +++ linux/include/linux/sched.h
> @@ -681,7 +681,7 @@ enum cpu_idle_type {
>  #define SCHED_LOAD_SHIFT 10
>  #define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT)
>  
> -#define SCHED_LOAD_SCALE_FUZZ(SCHED_LOAD_SCALE >> 1)
> +#define SCHED_LOAD_SCALE_FUZZSCHED_LOAD_SCALE
>  
>  #ifdef CONFIG_SMP
>  #define SD_LOAD_BALANCE  1   /* Do load balancing on this 
> domain. */
> Index: linux/kernel/sched.c
> ===
> --- linux.orig/kernel/sched.c
> +++ linux/kernel/sched.c
> @@ -2517,7 +2517,7 @@ group_next:
>* a think about bumping its value to force at least one task to be
>* moved
>*/
> - if (*imbalance + SCHED_LOAD_SCALE_FUZZ < busiest_load_per_task/2) {
> + if (*imbalance + SCHED_LOAD_SCALE_FUZZ < busiest_load_per_task) {

Ingo, this is still broken. This condition is always false for nice-0 tasks..

thanks,
suresh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] export __put_task_struct for XPMEM

2007-08-27 Thread Dean Nelson
On Mon, Aug 27, 2007 at 07:15:44PM +0100, Al Viro wrote:
> On Mon, Aug 27, 2007 at 01:10:56PM -0500, Dean Nelson wrote:
> > On Mon, Aug 27, 2007 at 05:13:28PM +0100, Al Viro wrote:
> > > On Mon, Aug 27, 2007 at 10:59:33AM -0500, Dean Nelson wrote:
> > > > This patch exports __put_task_struct as it is needed by XPMEM.
> > > > 
> > > > Signed-off-by: Dean Nelson <[EMAIL PROTECTED]>
> > > > 
> > > > ---
> > > > 
> > > > One struct file_operations registered by XPMEM, xpmem_open(), calls
> > > > 'get_task_struct(current->group_leader)' and another, xpmem_flush(), 
> > > > calls
> > > > 'put_task_struct(tg->group_leader)'.
> > > 
> > > Does it?  Well, then open the file in question and start doing 
> > > close(dup(fd))
> > > in a loop.  Won't take long for an oops...
> > 
> > Actually it won't oops. And that's because when the file is opened,
> > xpmem_open() creates a structure for that thread group, and when
> > xpmem_flush() is called on the close() it first looks for that structure
> > and if it finds it then it does what it needs to do (which includes the
> > put_task_struct() call) and then finishes off by destroying the structure.
> > So for subsequent closes xpmem_flush() returns without calling
> > put_task_struct().
> 
> Then what kind of protection does it get you?  It can be called immediately
> after the call of ->open(), so you can't rely on it being there for any
> operations.  Makes no sense...

No operations can be done once it's closed, only while it's opened.

At fault time we need to be able to fault pages that belong to another
thread group. To call get_user_pages() we need to have the task_struct
and the mm_struct for the other thread group.

At one time we did look up the task_struct by pid, but that brought the
system to its knees due to heavy lock contention.

Do you know of a better way of doing this?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] sched: fix broken smt/mc optimizations with CFS

2007-08-27 Thread Ingo Molnar

* Siddha, Suresh B <[EMAIL PROTECTED]> wrote:

> > -   if (*imbalance + SCHED_LOAD_SCALE_FUZZ < busiest_load_per_task/2) {
> > +   if (*imbalance + SCHED_LOAD_SCALE_FUZZ < busiest_load_per_task) {
> 
> Ingo, this is still broken. This condition is always false for nice-0 
> tasks..

yes - negative reniced tasks are not spread out via this - and positive 
reniced tasks are spread out more easily.

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 00/28] Add cmpxchg64_local and cmpxchg_local to each architecture

2007-08-27 Thread Christoph Lameter
On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:

> Good point. Christoph, could you please prepare a slub cmpxchg_local
> patch for the mm tree ?

Patch follows (on top of the per cpu structures patch):

Note that we still have a ways to go before the cmpxchg_local 
implementation for slub is ready to be included. Right now we are surely 
causing a regression on non x86 platforms. There needs to be some sort of 
agreement on how to use cmpxchg_local in a way that does not cause harm 
for other architectures.

Once we have that in place then the same method that is applied to the 
SLUB fastpath can also be applied to the vm statistics. I have a patch 
here that does that. We could then also optimize the page allocator to do 
the same.

---
 include/linux/slub_def.h |   10 +++---
 mm/slub.c|   76 ---
 2 files changed, 58 insertions(+), 28 deletions(-)

Index: linux-2.6/mm/slub.c
===
--- linux-2.6.orig/mm/slub.c2007-08-22 21:42:40.0 -0700
+++ linux-2.6/mm/slub.c 2007-08-22 21:42:53.0 -0700
@@ -1442,13 +1442,18 @@ static void *__slab_alloc(struct kmem_ca
 {
void **object;
struct page *new;
+   unsigned long flags;
 
+   local_irq_save(flags);
+   put_cpu_no_resched();
if (!c->page)
+   /* Slab was flushed */
goto new_slab;
 
slab_lock(c->page);
if (unlikely(!node_match(c, node)))
goto another_slab;
+
 load_freelist:
object = c->page->freelist;
if (unlikely(!object))
@@ -1457,11 +1462,16 @@ load_freelist:
goto debug;
 
object = c->page->freelist;
-   c->freelist = object[c->offset];
c->page->inuse = s->objects;
c->page->freelist = NULL;
c->node = page_to_nid(c->page);
+   c->freelist = object[c->offset];
+out:
slab_unlock(c->page);
+   local_irq_restore(flags);
+   preempt_check_resched();
+   if (unlikely((gfpflags & __GFP_ZERO)))
+   memset(object, 0, c->objsize);
return object;
 
 another_slab:
@@ -1502,6 +1512,8 @@ new_slab:
c->page = new;
goto load_freelist;
}
+   local_irq_restore(flags);
+   preempt_check_resched();
return NULL;
 debug:
object = c->page->freelist;
@@ -1511,8 +1523,7 @@ debug:
c->page->inuse++;
c->page->freelist = object[c->offset];
c->node = -1;
-   slab_unlock(c->page);
-   return object;
+   goto out;
 }
 
 /*
@@ -1529,25 +1540,29 @@ static void __always_inline *slab_alloc(
gfp_t gfpflags, int node, void *addr)
 {
void **object;
-   unsigned long flags;
struct kmem_cache_cpu *c;
 
-   local_irq_save(flags);
-   c = get_cpu_slab(s, smp_processor_id());
-   if (unlikely(!c->freelist || !node_match(c, node)))
+   c = get_cpu_slab(s, get_cpu());
+redo:
+   object = c->freelist;
+   if (unlikely(!object))
+   goto slow;
 
-   object = __slab_alloc(s, gfpflags, node, addr, c);
+   if (unlikely(!node_match(c, node)))
+   goto slow;
 
-   else {
-   object = c->freelist;
-   c->freelist = object[c->offset];
-   }
-   local_irq_restore(flags);
+   if (unlikely(cmpxchg_local(&c->freelist, object,
+   object[c->offset]) != object))
+   goto redo;
 
-   if (unlikely((gfpflags & __GFP_ZERO) && object))
+   put_cpu();
+   if (unlikely((gfpflags & __GFP_ZERO)))
memset(object, 0, c->objsize);
 
return object;
+slow:
+   return __slab_alloc(s, gfpflags, node, addr, c);
+
 }
 
 void *kmem_cache_alloc(struct kmem_cache *s, gfp_t gfpflags)
@@ -1577,7 +1592,10 @@ static void __slab_free(struct kmem_cach
 {
void *prior;
void **object = (void *)x;
+   unsigned long flags;
 
+   put_cpu();
+   local_irq_save(flags);
slab_lock(page);
 
if (unlikely(SlabDebug(page)))
@@ -1603,6 +1621,7 @@ checks_ok:
 
 out_unlock:
slab_unlock(page);
+   local_irq_restore(flags);
return;
 
 slab_empty:
@@ -1613,6 +1632,7 @@ slab_empty:
remove_partial(s, page);
 
slab_unlock(page);
+   local_irq_restore(flags);
discard_slab(s, page);
return;
 
@@ -1637,19 +1657,29 @@ static void __always_inline slab_free(st
struct page *page, void *x, void *addr)
 {
void **object = (void *)x;
-   unsigned long flags;
+   void **freelist;
struct kmem_cache_cpu *c;
 
-   local_irq_save(flags);
debug_check_no_locks_freed(object, s->objsize);
-   c = get_cpu_slab(s, smp_processor_id());
-   if (likely(page == c->page && c->node >= 0)) {
-   object[c->offset] = c->freelist;
-   c->freelist = object;
- 

Re: [patch] sched: fix broken smt/mc optimizations with CFS

2007-08-27 Thread Siddha, Suresh B
On Mon, Aug 27, 2007 at 09:23:24PM +0200, Ingo Molnar wrote:
> 
> * Siddha, Suresh B <[EMAIL PROTECTED]> wrote:
> 
> > > - if (*imbalance + SCHED_LOAD_SCALE_FUZZ < busiest_load_per_task/2) {
> > > + if (*imbalance + SCHED_LOAD_SCALE_FUZZ < busiest_load_per_task) {
> > 
> > Ingo, this is still broken. This condition is always false for nice-0 
> > tasks..
> 
> yes - negative reniced tasks are not spread out via this - and positive 
> reniced tasks are spread out more easily.

Or the opposite?

Essentially I observed that nice 0 tasks still endup on two cores of same
package, with out getting spread out to two different packages. This behavior
is same with out this fix and this fix doesn't help in any way.

thanks,
suresh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [md-accel PATCH 16/19] dmaengine: driver for the iop32x, iop33x, and iop13xx raid engines

2007-08-27 Thread Williams, Dan J
> From: saeed bishara [mailto:[EMAIL PROTECTED]
> Hi Dan,
> I think you have a bug in this function, the list_splice_init adds the
> new slots in the head of the chain_node, but you get the
> old_chain_tail (latest descriptor) from the tail of the chain!!
> 
>  > +static dma_cookie_t
>  > +iop_adma_tx_submit(struct dma_async_tx_descriptor *tx)
>  > +{
>  > +
>  > +   old_chain_tail = list_entry(iop_chan->chain.prev,
>  > +   struct iop_adma_desc_slot, chain_node);
>  > +   list_splice_init(&sw_desc->group_list, &old_chain_tail-
> >chain_node);
>  > +
>  > +   /* fix up the hardware chain */
>  > +   iop_desc_set_next_desc(old_chain_tail, grp_start->phys);
>  > +
[ dropped akpm, davem, jeff, and chris from the cc ]

This looks ok to me.  &sw_desc->group_list is the head of a new list of
descriptors to be added to the chain.  old_chain_tail is youngest
descriptor at the end of the current channel chain.

Before list_splice_init:
old_chain_tail->next = channel_chain_head
channel_chain_head->prev = old_chain_tail
new_chain_start->prev = sw_desc->group_list;
new_chain_end->next = sw_desc->group_list;

After list_splice_init:
new_chain_start->prev = old_chain_tail
old_chain_tail->next = new_chain_start
new_chain_end->next = channel_chain_head
channel_chain_head->prev = new_chain_end

sw_desc->group_list is empty

--
Dan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: nfs4 filesystem mounted via the "bind" option reports wrong fstype

2007-08-27 Thread J. Bruce Fields
On Mon, Aug 27, 2007 at 08:15:07PM +0100, Al Viro wrote:
> On Mon, Aug 27, 2007 at 02:40:59PM -0400, J. Bruce Fields wrote:
>  
> > There's no reason not to just mount server:/exports/data directly at
> > /home/data; the bind mounts are just a workaround for the somewhat
> > primitive exports facility on the server side.
> 
> Bullshit.  Bindings are first-class operations on _client_, regardless
> of fs types involved.

I know.  Did I say something to the contrary?

Maybe I was too terse; in more detail: the original poster appears to be
mounting server:/exports/data by first mounting server:/ somewhere and
then bind-mounting the exports/data someplace else.  I couldn't see an
obvious reason they'd be using two steps instead of just performing a
single mount of server:/exports/data.

So my assumption was that this was due to a confused memory of some
server-side setup instructions.  (On the server side, nfs4 export setup
often requires the administrator to do some extra bind mounts which
shouldn't really be necessary.)

--b.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 13/28] Add cmpxchg_local, cmpxchg64 and cmpxchg64_local to ia64

2007-08-27 Thread Christoph Lameter
On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:

> Add the primitives cmpxchg_local, cmpxchg64 and cmpxchg64_local to ia64. They
> use cmpxchg_acq as underlying macro, just like the already existing ia64
> cmpxchg().

Acked-by: Christoph Lameter <[EMAIL PROTECTED]>

Note cmpxchg is *not* a performance win vs interrupt disable / enable on IA64.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] export __put_task_struct for XPMEM

2007-08-27 Thread Al Viro
On Mon, Aug 27, 2007 at 02:19:06PM -0500, Dean Nelson wrote:

> No operations can be done once it's closed, only while it's opened.

What the hell do you mean, can't be done?

fd = open(...);
fp = popen("/bin/date", "r");
/* read from fp */
fclose(fp);
do operations on fd

And you've got yourself
open
fork duplicating descriptor
exit closing that duplicate
IO on original, after call of flush
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 00/28] Add cmpxchg64_local and cmpxchg_local to each architecture

2007-08-27 Thread Christoph Lameter
On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:

> Here is the patch series for 2.6.23-rc3-mm1 that adds cmpxchg_local, and now
> also cmpxchg64_local, to each architecture.

Any planned uses of cmpxchg64_local? 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] SLUB use cmpxchg_local

2007-08-27 Thread Christoph Lameter
On Mon, 27 Aug 2007, Peter Zijlstra wrote:

> So, if the fast path can be done with a preempt off, it might be doable
> to suffer the slow path with a per cpu lock like that.

Sadly the cmpxchg_local requires local per cpu data access. Isnt there 
some way to make this less expensive on RT? Acessing cpu local memory is 
really good for performance on NUMA since the data is optimally placed and 
one can avoid/reduce locking if the process stays tied to the processor.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/3] KVM paravirtualization framework (v2)

2007-08-27 Thread Anthony Liguori
This patchset refactors KVM's paravirtualization support to better support
guest SMP and cross platform migration.  It also introduces a bare-bones KVM
paravirt_ops implementation.

I've tested this on VT and it works nicely.  I'm having trouble getting a
bzImage to boot on SVM so I haven't been able to test on SVM yet.

I've incorporated all of the feedback into this series from posting the
last series.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] Refactor hypercall infrastructure (v2)

2007-08-27 Thread Anthony Liguori
This patch refactors the current hypercall infrastructure to better support live
migration and SMP.  It eliminates the hypercall page by trapping the UD
exception that would occur if you used the wrong hypercall instruction for the
underlying architecture and replacing it with the right one lazily.

It also introduces the infrastructure to probe for hypercall available via
CPUID leaves 0x4002.  CPUID leaf 0x4003 should be filled out by
userspace.

A fall-out of this patch is that the unhandled hypercalls no longer trap to
userspace.  There is very little reason though to use a hypercall to communicate
with userspace as PIO or MMIO can be used.  There is no code in tree that uses
userspace hypercalls.

Since v1, we now use emulator_write_emulated() and zap the MMU while holding
kvm->lock to ensure atomicity on SMP.  We also switch the KVM errnos to be
integer based and make kvm_para.h #include-able from userspace.

Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]>

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index a42a6f3..38c0eaf 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -46,6 +46,7 @@
 #define KVM_MAX_CPUID_ENTRIES 40
 
 #define DE_VECTOR 0
+#define UD_VECTOR 6
 #define NM_VECTOR 7
 #define DF_VECTOR 8
 #define TS_VECTOR 10
@@ -316,9 +317,6 @@ struct kvm_vcpu {
unsigned long cr0;
unsigned long cr2;
unsigned long cr3;
-   gpa_t para_state_gpa;
-   struct page *para_state_page;
-   gpa_t hypercall_gpa;
unsigned long cr4;
unsigned long cr8;
u64 pdptrs[4]; /* pae */
@@ -587,7 +585,9 @@ void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu);
 int kvm_mmu_load(struct kvm_vcpu *vcpu);
 void kvm_mmu_unload(struct kvm_vcpu *vcpu);
 
-int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run);
+int kvm_emulate_hypercall(struct kvm_vcpu *vcpu);
+
+int kvm_fix_hypercall(struct kvm_vcpu *vcpu);
 
 static inline int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva,
 u32 error_code)
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index d154487..177cba1 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1267,51 +1267,61 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu)
 }
 EXPORT_SYMBOL_GPL(kvm_emulate_halt);
 
-int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run)
+int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
 {
-   unsigned long nr, a0, a1, a2, a3, a4, a5, ret;
+   unsigned long nr, a0, a1, a2, a3, ret;
 
kvm_arch_ops->cache_regs(vcpu);
-   ret = -KVM_EINVAL;
-#ifdef CONFIG_X86_64
-   if (is_long_mode(vcpu)) {
-   nr = vcpu->regs[VCPU_REGS_RAX];
-   a0 = vcpu->regs[VCPU_REGS_RDI];
-   a1 = vcpu->regs[VCPU_REGS_RSI];
-   a2 = vcpu->regs[VCPU_REGS_RDX];
-   a3 = vcpu->regs[VCPU_REGS_RCX];
-   a4 = vcpu->regs[VCPU_REGS_R8];
-   a5 = vcpu->regs[VCPU_REGS_R9];
-   } else
-#endif
-   {
-   nr = vcpu->regs[VCPU_REGS_RBX] & -1u;
-   a0 = vcpu->regs[VCPU_REGS_RAX] & -1u;
-   a1 = vcpu->regs[VCPU_REGS_RCX] & -1u;
-   a2 = vcpu->regs[VCPU_REGS_RDX] & -1u;
-   a3 = vcpu->regs[VCPU_REGS_RSI] & -1u;
-   a4 = vcpu->regs[VCPU_REGS_RDI] & -1u;
-   a5 = vcpu->regs[VCPU_REGS_RBP] & -1u;
+
+   nr = vcpu->regs[VCPU_REGS_RAX];
+   a0 = vcpu->regs[VCPU_REGS_RBX];
+   a1 = vcpu->regs[VCPU_REGS_RCX];
+   a2 = vcpu->regs[VCPU_REGS_RDX];
+   a3 = vcpu->regs[VCPU_REGS_RSI];
+
+   if (!is_long_mode(vcpu)) {
+   nr &= ~1u;
+   a0 &= ~1u;
+   a1 &= ~1u;
+   a2 &= ~1u;
+   a3 &= ~1u;
}
+
switch (nr) {
default:
-   run->hypercall.nr = nr;
-   run->hypercall.args[0] = a0;
-   run->hypercall.args[1] = a1;
-   run->hypercall.args[2] = a2;
-   run->hypercall.args[3] = a3;
-   run->hypercall.args[4] = a4;
-   run->hypercall.args[5] = a5;
-   run->hypercall.ret = ret;
-   run->hypercall.longmode = is_long_mode(vcpu);
-   kvm_arch_ops->decache_regs(vcpu);
-   return 0;
+   ret = -KVM_ENOSYS;
+   break;
}
vcpu->regs[VCPU_REGS_RAX] = ret;
kvm_arch_ops->decache_regs(vcpu);
-   return 1;
+   return 0;
+}
+EXPORT_SYMBOL_GPL(kvm_emulate_hypercall);
+
+int kvm_fix_hypercall(struct kvm_vcpu *vcpu)
+{
+   char instruction[3];
+   int ret = 0;
+
+   mutex_lock(&vcpu->kvm->lock);
+
+   /*
+* Blow out the MMU to ensure that no other VCPU has an active mapping
+* to ensure that the updated hypercall appears atomically across all
+* VCPUs.
+*/
+   kvm_mmu_zap_all(vcpu->kvm);
+
+   kvm_arch_ops->cache_regs(vcpu);
+   kvm_arch_ops->patch_hypercall(vcpu, instr

[PATCH 2/3] KVM paravirt-ops implementation (v2)

2007-08-27 Thread Anthony Liguori
A very simple paravirt_ops implementation for KVM.  Future patches will add
more sophisticated optimizations.  The goal of having this presenting this now
is to validate the new hypercall infrastructure and to make my patch queue
smaller.

Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]>

diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index f952493..ceacc66 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -237,6 +237,13 @@ config VMI
  at the moment), by linking the kernel to a GPL-ed ROM module
  provided by the hypervisor.
 
+config KVM_GUEST
+   bool "KVM paravirt-ops support"
+   depends on PARAVIRT
+   help
+ This option enables various optimizations for running under the KVM
+  hypervisor.
+
 config ACPI_SRAT
bool
default y
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 9d33b00..6308fcf 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_K8_NB)   += k8.o
 obj-$(CONFIG_MGEODE_LX)+= geode.o
 
 obj-$(CONFIG_VMI)  += vmi.o vmiclock.o
+obj-$(CONFIG_KVM_GUEST)+= kvm.o
 obj-$(CONFIG_PARAVIRT) += paravirt.o
 obj-y  += pcspeaker.o
 
diff --git a/arch/i386/kernel/kvm.c b/arch/i386/kernel/kvm.c
new file mode 100644
index 000..26585a4
--- /dev/null
+++ b/arch/i386/kernel/kvm.c
@@ -0,0 +1,46 @@
+/*
+ * KVM paravirt_ops implementation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corporation, 2007
+ *   Authors: Anthony Liguori <[EMAIL PROTECTED]>
+ */
+
+#include 
+#include 
+
+/*
+ * No need for any "IO delay" on KVM
+ */
+static void kvm_io_delay(void)
+{
+}
+
+static __init void paravirt_setup(void)
+{
+   paravirt_ops.name = "KVM";
+
+   if (kvm_para_has_feature(KVM_PARA_FEATURE_NOP_IO_DELAY))
+   paravirt_ops.io_delay = kvm_io_delay;
+
+   paravirt_ops.paravirt_enabled = 1;
+}
+
+void __init kvm_guest_init(void)
+{
+   if (kvm_para_available())
+   paravirt_setup();
+}
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 0f94138..10b2e7a 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -4,6 +4,14 @@
 #ifdef __KERNEL__
 #include 
 
+#ifdef CONFIG_KVM_GUEST
+void __init kvm_guest_init(void);
+#else
+static inline void kvm_guest_init(void)
+{
+}
+#endif
+
 #define KVM_HYPERCALL ".byte 0x0f,0x01,0xc1"
 
 static inline long kvm_hypercall0(unsigned int nr)
diff --git a/init/main.c b/init/main.c
index d3bcb3b..b224905 100644
--- a/init/main.c
+++ b/init/main.c
@@ -55,6 +55,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -569,6 +570,7 @@ asmlinkage void __init start_kernel(void)
}
sort_main_extable();
trap_init();
+   kvm_guest_init();
rcu_init();
init_IRQ();
pidhash_init();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] SLUB: use have_arch_cmpxchg()

2007-08-27 Thread Christoph Lameter
On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:

> Hrm, actually, I don't think such have_arch_cmpxchg() macro will be
> required at all because of the small performance hit disabling
> preemption will have on the slow and fast paths. Let's compare, for each
> of the slow path and fast path, what locking looks like on architecture
> with and without local cmpxchg:
> 
> What we actually do here is:
> 
> fast path:
> with local_cmpxchg:
>   preempt_disable()
>   preempt_enable()
> without local_cmpxchg:
>   preempt_disable()
>   local_irq_save
>   local_irq_restore
>   preempt_enable()
> (we therefore disable preemption _and_ disable interrupts for
> nothing)

Hmmm. This is a performance issue for preempt kernels.

> slow path:
> both with and without local_cmpxchg():
>   preempt_disable()
>   preempt_enable()

Here we potentially loose our per cpu structure since the process may be 
rescheduled.

>   local_irq_save()
>   local_irq_restore()
> 
> 
> Therefore, we would add preempt disable/enable to the fast path of
> architectures where local_cmpxchg is emulated with irqs off. But since
> preempt disable/enable is just a check counter increment/decrement with
> barrier() and thread flag check, I doubt it would hurt performances
> enough to justify the added complexity of disabling interrupts for the
> whole fast path in this case.

One additional cacheline referenced in the hot path. Ok the counter may be 
hot as well if this is a preemptible kernel. Nevertheless a cause for 
concern.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/6] x86: fix cpu_to_node references (v2)

2007-08-27 Thread Mike Travis


On Fri, 24 Aug 2007, Siddha, Suresh B wrote:

> On Fri, Aug 24, 2007 at 03:26:55PM -0700, [EMAIL PROTECTED] wrote:
> > Fix four instances where cpu_to_node is referenced
> > by array instead of via the cpu_to_node macro.  This
> > is preparation to moving it to the per_cpu data area.
> >
> ...
>
> >  unsigned long __init numa_free_all_bootmem(void)
> > --- a/arch/x86_64/mm/srat.c
> > +++ b/arch/x86_64/mm/srat.c
> > @@ -431,9 +431,9 @@
> > setup_node_bootmem(i, nodes[i].start, nodes[i].end);
> >
> > for (i = 0; i < NR_CPUS; i++) {
> > -   if (cpu_to_node[i] == NUMA_NO_NODE)
> > +   if (cpu_to_node(i) == NUMA_NO_NODE)
> > continue;
> > -   if (!node_isset(cpu_to_node[i], node_possible_map))
> > +   if (!node_isset(cpu_to_node(i), node_possible_map))
> > numa_set_node(i, NUMA_NO_NODE);
> > }
> > numa_init_array();
>
> During this particular routine execution, per cpu areas are not yet setup. In
> future, when we make cpu_to_node(i) use per cpu area, then this code will 
> break.
>
> And actually setup_per_cpu_areas() uses cpu_to_node(). So...
>

I have a scheme to use an __initdata array during __init processing which
is removed after the per cpu data area is setup.  I'm looking more closely
at all the various node <--> cpu tables.

Thanks,
Mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] cciss: fix error reporting for SG_IO

2007-08-27 Thread Mike Miller (OS Dev)
On Fri, Aug 24, 2007 at 05:10:47PM -0700, Andrew Morton wrote:
> On Fri, 24 Aug 2007 12:53:54 -0500
> "Mike Miller (OS Dev)" <[EMAIL PROTECTED]> wrote:
> 
> > This fixes a problem with the way cciss was filling out the "errors"
> > field of the request structure upon completion of requests. 
> > Previously, it just put a 1 or a 0 in there and used the negation
> > of this as the uptodate parameter to one of the functions in the
> > block layer, being a block device.  For the SG_IO ioctl, this was not
> > sufficient, and we noticed that, for example, sg_turs from sg3_utils 
> > did not correctly detect problems due to cciss having set rq->errors 
> > incorrectly.
> 
> Do we think this problem is sufficiently serious to merit merging
> this (largeish) patch into 2.6.23?
> 
> I'm thinking "no", but that might be wrong...

We'd like to see it 2.6.23. It may help insulate me from lots of questions
about where it is. :) But it's entirely up to you.

mikem
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: uncached page allocator

2007-08-27 Thread Christoph Lameter
There is an uncached allocator in IA64 arch code 
(linux/arch/ia64/kernel/uncached.c). Maybe having a look at 
that will help? Jes wrote it.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/4] add SGI Altix cross partition memory (XPMEM) driver

2007-08-27 Thread Adrian Bunk
On Mon, Aug 27, 2007 at 11:41:12AM -0500, Dean Nelson wrote:
> This patch has been bzip2'd and included as an attachment due to size.

200 kB shouldn't be a problem
(AFAIR the current limit on linux-kernel is 400 kB).

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: nfs4 filesystem mounted via the "bind" option reports wrong fstype

2007-08-27 Thread Gabriel Barazer
On 08/27/2007 9:32:42 PM +0200, "J. Bruce Fields" <[EMAIL PROTECTED]> 
wrote:

On Mon, Aug 27, 2007 at 08:15:07PM +0100, Al Viro wrote:

On Mon, Aug 27, 2007 at 02:40:59PM -0400, J. Bruce Fields wrote:
 

There's no reason not to just mount server:/exports/data directly at
/home/data; the bind mounts are just a workaround for the somewhat
primitive exports facility on the server side.

Bullshit.  Bindings are first-class operations on _client_, regardless
of fs types involved.


I know.  Did I say something to the contrary?

Maybe I was too terse; in more detail: the original poster appears to be
mounting server:/exports/data by first mounting server:/ somewhere and
then bind-mounting the exports/data someplace else.  I couldn't see an
obvious reason they'd be using two steps instead of just performing a
single mount of server:/exports/data.

So my assumption was that this was due to a confused memory of some
server-side setup instructions. (On the server side, nfs4 export setup
often requires the administrator to do some extra bind mounts which
shouldn't really be necessary.)


Right. When setting up the clients, I remembered these "bind" mount 
things, and applied the same client-side because at this time I had 
other bugs for which I thought "bind" mount was the solution. In fact 
it's not, but as nfs4 is seen as a unique filesystem and I had several 
exported volumes, It was easier to mount the nfsv4 pseudoroot, then 
"bind" mount all the volumes from it.


But the bug's still here, and since these additional mounts appear 
"magically" in /proc/mounts, I don't know where to look at in the kernel 
source. The nfsv4 client code must have somewhere a kind of nfs4 
automounter for "nohide" volumes. A bit ugly IMHO, but the only way to 
show quotas for separates nfsv4 exported volumes too.


Gabriel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 00/28] Add cmpxchg64_local and cmpxchg_local to each architecture

2007-08-27 Thread Mathieu Desnoyers
* Christoph Lameter ([EMAIL PROTECTED]) wrote:
> On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:
> 
> > Here is the patch series for 2.6.23-rc3-mm1 that adds cmpxchg_local, and now
> > also cmpxchg64_local, to each architecture.
> 
> Any planned uses of cmpxchg64_local? 

Let's say it could possibly eliminate the xtime read seqlock on x86
(should be investigated) and can be useful to overcome the
non-synchronized TSC handling when taking TSC-based timestamps. All
these operations require locking to play with 64 bits values on 32 bits
architectures, which could be improved by cmpxchg64_local.

But again, it would require some testing to see if we can improve
performances there.

Mathieu

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] hotplug cpu: documentation addition to downing a cpu

2007-08-27 Thread Cliff Wickman

In answer to Andrew:
> How do we communicate this new design/feature to our users?
> Documentation/cpusets.txt, perhaps?  Documentation/cpu-hotplug.txt?
> git-log?  ;)

Patch "[PATCH 1/1] V4: hotplug cpu: migrate a task within its cpuset" may
warrant an addition to the documentation.  I would propose this note
in cpu-hotplug.txt.

Diffed against 2.6.23-rc3

Signed-off-by: Cliff Wickman <[EMAIL PROTECTED]>

---
 Documentation/cpu-hotplug.txt |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linus.070821/Documentation/cpu-hotplug.txt
===
--- linus.070821.orig/Documentation/cpu-hotplug.txt
+++ linus.070821/Documentation/cpu-hotplug.txt
@@ -220,7 +220,9 @@ A: The following happen, listed in no pa
   CPU_DOWN_PREPARE or CPU_DOWN_PREPARE_FROZEN, depending on whether or not the
   CPU is being offlined while tasks are frozen due to a suspend operation in
   progress
-- All process is migrated away from this outgoing CPU to a new CPU
+- All processes are migrated away from this outgoing CPU to new CPUs.
+  The new CPU is chosen from each process' current cpuset, which may be
+  a subset of all online CPUs.
 - All interrupts targeted to this CPU is migrated to a new CPU
 - timers/bottom half/task lets are also migrated to a new CPU
 - Once all services are migrated, kernel calls an arch specific routine
-- 
Cliff Wickman
Silicon Graphics, Inc.
[EMAIL PROTECTED]
(651) 683-3824
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] SLUB use cmpxchg_local

2007-08-27 Thread Mathieu Desnoyers
* Christoph Lameter ([EMAIL PROTECTED]) wrote:
> On Mon, 27 Aug 2007, Peter Zijlstra wrote:
> 
> > So, if the fast path can be done with a preempt off, it might be doable
> > to suffer the slow path with a per cpu lock like that.
> 
> Sadly the cmpxchg_local requires local per cpu data access. Isnt there 
> some way to make this less expensive on RT? Acessing cpu local memory is 
> really good for performance on NUMA since the data is optimally placed and 
> one can avoid/reduce locking if the process stays tied to the processor.
> 

On the slow path, in slab_new, we already have to reenable interrupts
because we can sleep. If we make sure that whenever we return to an irq
disable code path we take the current per-cpu data structure again, can
we make the preempt-disable/irq-disabled code paths O(1) ?

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/15] nfsd: tone down inaccurate dprintk

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

The nfserr_dropit happens routinely on upcalls (so a kmalloc failure is
almost never the actual cause), but I occasionally get a complant from
some tester that's worried because they ran across this message after
turning on debugging to research some unrelated problem.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfssvc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index a8c89ae..221eeaa 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -549,7 +549,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
if (nfserr == nfserr_jukebox && rqstp->rq_vers == 2)
nfserr = nfserr_dropit;
if (nfserr == nfserr_dropit) {
-   dprintk("nfsd: Dropping request due to malloc failure!\n");
+   dprintk("nfsd: Dropping request; may be revisited later\n");
nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
return 0;
}
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/15] knfsd: delete code made redundant by map_new_errors

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

I moved this check into map_new_errors, but forgot to delete the
original.  Oops.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfssvc.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 221eeaa..ef46f32 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -546,8 +546,6 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
/* Now call the procedure handler, and encode NFS status. */
nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
nfserr = map_new_errors(rqstp->rq_vers, nfserr);
-   if (nfserr == nfserr_jukebox && rqstp->rq_vers == 2)
-   nfserr = nfserr_dropit;
if (nfserr == nfserr_dropit) {
dprintk("nfsd: Dropping request; may be revisited later\n");
nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/15] nfsd: remove unused cache_for_each macro

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

This macro is unused.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 include/linux/sunrpc/cache.h |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 3699dff..bd7a6b0 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -136,16 +136,6 @@ sunrpc_cache_update(struct cache_detail *detail,
struct cache_head *new, struct cache_head *old, int hash);
 
 
-#define cache_for_each(pos, detail, index, member) 
\
-   for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) 
;\
-({if (index==0)read_unlock(&(detail)->hash_lock); index--;});  
\
-   )   
\
-   for (pos = container_of((detail)->hash_table[index], 
typeof(*pos), member); \
-&pos->member;  
\
-pos = container_of(pos->member.next, typeof(*pos), member))
-
-
-
 extern void cache_clean_deferred(void *owner);
 
 static inline struct cache_head  *cache_get(struct cache_head *h)
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/15] knfsd: nfs4 name->id mapping not correctly parsing negative downcall

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

Note that qword_get() returns length or -1, not an -ERROR.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfs4idmap.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 2ccffde..4c0c683 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -207,6 +207,7 @@ idtoname_parse(struct cache_detail *cd, char *buf, int 
buflen)
 {
struct ent ent, *res;
char *buf1, *bp;
+   int len;
int error = -EINVAL;
 
if (buf[buflen - 1] != '\n')
@@ -248,10 +249,11 @@ idtoname_parse(struct cache_detail *cd, char *buf, int 
buflen)
goto out;
 
/* Name */
-   error = qword_get(&buf, buf1, PAGE_SIZE);
-   if (error == -EINVAL)
+   error = -EINVAL;
+   len = qword_get(&buf, buf1, PAGE_SIZE);
+   if (len < 0)
goto out;
-   if (error == -ENOENT)
+   if (len == 0)
set_bit(CACHE_NEGATIVE, &ent.h.flags);
else {
if (error >= IDMAP_NAMESZ) {
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/15] knfsd: cleanup of nfsd4 cmp_* functions

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

Benny Halevy suggested renaming cmp_* to same_* to make the meaning of
the return value clearer.

Fix some nearby style deviations while we're at it, including a small
swath of creative indentation in nfs4_preprocess_seqid_op().

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfs4state.c |   91 ++
 1 files changed, 47 insertions(+), 44 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 3f55970..578d809 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -462,26 +462,28 @@ copy_cred(struct svc_cred *target, struct svc_cred 
*source) {
 }
 
 static inline int
-same_name(const char *n1, const char *n2) {
+same_name(const char *n1, const char *n2)
+{
return 0 == memcmp(n1, n2, HEXDIR_LEN);
 }
 
 static int
-cmp_verf(nfs4_verifier *v1, nfs4_verifier *v2) {
-   return(!memcmp(v1->data,v2->data,sizeof(v1->data)));
+same_verf(nfs4_verifier *v1, nfs4_verifier *v2)
+{
+   return 0 == memcmp(v1->data, v2->data, sizeof(v1->data));
 }
 
 static int
-cmp_clid(clientid_t * cl1, clientid_t * cl2) {
-   return((cl1->cl_boot == cl2->cl_boot) &&
-   (cl1->cl_id == cl2->cl_id));
+same_clid(clientid_t *cl1, clientid_t *cl2)
+{
+   return (cl1->cl_boot == cl2->cl_boot) && (cl1->cl_id == cl2->cl_id);
 }
 
 /* XXX what about NGROUP */
 static int
-cmp_creds(struct svc_cred *cr1, struct svc_cred *cr2){
-   return(cr1->cr_uid == cr2->cr_uid);
-
+same_creds(struct svc_cred *cr1, struct svc_cred *cr2)
+{
+   return cr1->cr_uid == cr2->cr_uid;
 }
 
 static void
@@ -546,7 +548,7 @@ find_confirmed_client(clientid_t *clid)
unsigned int idhashval = clientid_hashval(clid->cl_id);
 
list_for_each_entry(clp, &conf_id_hashtbl[idhashval], cl_idhash) {
-   if (cmp_clid(&clp->cl_clientid, clid))
+   if (same_clid(&clp->cl_clientid, clid))
return clp;
}
return NULL;
@@ -559,7 +561,7 @@ find_unconfirmed_client(clientid_t *clid)
unsigned int idhashval = clientid_hashval(clid->cl_id);
 
list_for_each_entry(clp, &unconf_id_hashtbl[idhashval], cl_idhash) {
-   if (cmp_clid(&clp->cl_clientid, clid))
+   if (same_clid(&clp->cl_clientid, clid))
return clp;
}
return NULL;
@@ -753,7 +755,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct 
nfsd4_compound_state *cstate,
 * or different ip_address
 */
status = nfserr_clid_inuse;
-   if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred)
+   if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)
|| conf->cl_addr != sin->sin_addr.s_addr) {
dprintk("NFSD: setclientid: string in use by client"
"at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr));
@@ -779,7 +781,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct 
nfsd4_compound_state *cstate,
gen_confirm(new);
gen_callback(new, setclid);
add_to_unconfirmed(new, strhashval);
-   } else if (cmp_verf(&conf->cl_verifier, &clverifier)) {
+   } else if (same_verf(&conf->cl_verifier, &clverifier)) {
/*
 * CASE 1:
 * cl_name match, confirmed, principal match
@@ -830,7 +832,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct 
nfsd4_compound_state *cstate,
gen_confirm(new);
gen_callback(new, setclid);
add_to_unconfirmed(new, strhashval);
-   } else if (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm)) {
+   } else if (!same_verf(&conf->cl_confirm, &unconf->cl_confirm)) {
/*  
 * CASE3:
 * confirmed found (name, principal match)
@@ -910,16 +912,16 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
goto out;
 
if ((conf && unconf) && 
-   (cmp_verf(&unconf->cl_confirm, &confirm)) &&
-   (cmp_verf(&conf->cl_verifier, &unconf->cl_verifier)) &&
+   (same_verf(&unconf->cl_confirm, &confirm)) &&
+   (same_verf(&conf->cl_verifier, &unconf->cl_verifier)) &&
(same_name(conf->cl_recdir,unconf->cl_recdir))  &&
-   (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm))) {
+   (!same_verf(&conf->cl_confirm, &unconf->cl_confirm))) {
/* CASE 1:
* unconf record that matches input clientid and input confirm.
* conf record that matches input clientid.
* conf and unconf records match names, verifiers
*/
-   if (!cmp_creds(&conf->cl_cred, &unconf->cl_cred)) 
+   if (!same_creds(&conf->cl_cred, &unconf->cl_cred))
status = nfserr_clid_inuse;
else {
/* XXX: 

[PATCH 06/15] knfsd: demote some printk()s to dprintk()s

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

To quote a recent mail from Andrew Morton:

Look: if there's a way in which an unprivileged user can trigger
a printk we fix it, end of story.

OK.  I assume that goes double for printk()s that might be triggered by
random hosts on the internet.  So, disable some printk()s that look like
they could be triggered by malfunctioning or malicious clients.  For
now, just downgrade them to dprintk()s.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfs4proc.c  |4 ++--
 fs/nfsd/nfs4state.c |   20 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 29b7e63..18ead17 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -238,12 +238,12 @@ nfsd4_open(struct svc_rqst *rqstp, struct 
nfsd4_compound_state *cstate,
break;
case NFS4_OPEN_CLAIM_DELEGATE_PREV:
open->op_stateowner->so_confirmed = 1;
-   printk("NFSD: unsupported OPEN claim type %d\n",
+   dprintk("NFSD: unsupported OPEN claim type %d\n",
open->op_claim_type);
status = nfserr_notsupp;
goto out;
default:
-   printk("NFSD: Invalid OPEN claim type %d\n",
+   dprintk("NFSD: Invalid OPEN claim type %d\n",
open->op_claim_type);
status = nfserr_inval;
goto out;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 578d809..2b20eb8 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -509,7 +509,7 @@ check_name(struct xdr_netobj name) {
if (name.len == 0) 
return 0;
if (name.len > NFS4_OPAQUE_LIMIT) {
-   printk("NFSD: check_name: name too long(%d)!\n", name.len);
+   dprintk("NFSD: check_name: name too long(%d)!\n", name.len);
return 0;
}
return 1;
@@ -1742,7 +1742,7 @@ out:
if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS
&& flag == NFS4_OPEN_DELEGATE_NONE
&& open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE)
-   printk("NFSD: WARNING: refusing delegation reclaim\n");
+   dprintk("NFSD: WARNING: refusing delegation reclaim\n");
open->op_delegate_type = flag;
 }
 
@@ -2151,7 +2151,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 
seqid, stateid_t *statei
*sopp = NULL;
 
if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) {
-   printk("NFSD: preprocess_seqid_op: magic stateid!\n");
+   dprintk("NFSD: preprocess_seqid_op: magic stateid!\n");
return nfserr_bad_stateid;
}
 
@@ -2202,7 +2202,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 
seqid, stateid_t *statei
}
 
if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) {
-   printk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n");
+   dprintk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n");
return nfserr_bad_stateid;
}
 
@@ -2218,22 +2218,22 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 
seqid, stateid_t *statei
goto check_replay;
 
if (sop->so_confirmed && flags & CONFIRM) {
-   printk("NFSD: preprocess_seqid_op: expected"
+   dprintk("NFSD: preprocess_seqid_op: expected"
" unconfirmed stateowner!\n");
return nfserr_bad_stateid;
}
if (!sop->so_confirmed && !(flags & CONFIRM)) {
-   printk("NFSD: preprocess_seqid_op: stateowner not"
+   dprintk("NFSD: preprocess_seqid_op: stateowner not"
" confirmed yet!\n");
return nfserr_bad_stateid;
}
if (stateid->si_generation > stp->st_stateid.si_generation) {
-   printk("NFSD: preprocess_seqid_op: future stateid?!\n");
+   dprintk("NFSD: preprocess_seqid_op: future stateid?!\n");
return nfserr_bad_stateid;
}
 
if (stateid->si_generation < stp->st_stateid.si_generation) {
-   printk("NFSD: preprocess_seqid_op: old stateid!\n");
+   dprintk("NFSD: preprocess_seqid_op: old stateid!\n");
return nfserr_old_stateid;
}
renew_client(sop->so_client);
@@ -2245,7 +2245,7 @@ check_replay:
/* indicate replay to calling function */
return nfserr_replay_me;
}
-   printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n",
+   dprintk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n",
sop->so_seqid, seqid);
*sopp = NULL;
return nfserr_

nfs server patches for review

2007-08-27 Thread J. Bruce Fields

These are some nfs server patches I intend to submit for 2.6.24.

I'm also keeping this sort of thing in the nfs-server-stable branch, at

git://linux-nfs.org/~bfields/linux.git  nfs-server-stable

That repository has a bunch of random other (mainly nfs-related)
projects, but that particular branch is reserved for nfsd patches that I expect
to be ready in time for the next merge window.  If you have something
nfsd-related that I've overlooked, please let me know.

Nothing earth-shaking here right now, just minor cleanups, bugfixes, and
support from Peter Staubach for reporting 64 bit inode numbers.

--b.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/15] knfsd: move nfsv4 slab creation/destruction to module init/exit

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

We have some slabs that the nfs4 server uses to store state objects.
We're currently creating and destroying those slabs whenever the server
is brought up or down.  That seems excessive; may as well just do that
in module initialization and exit.

Also add some minor header cleanup.  (Thanks to Andrew Morton for that
and a compile fix.)

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfs4state.c   |   22 ++
 fs/nfsd/nfsctl.c  |5 -
 fs/nfsd/nfssvc.c  |4 +---
 include/linux/nfsd/nfsd.h |   18 ++
 4 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 2b20eb8..09573b9 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1021,7 +1021,7 @@ nfsd4_free_slab(struct kmem_cache **slab)
*slab = NULL;
 }
 
-static void
+void
 nfsd4_free_slabs(void)
 {
nfsd4_free_slab(&stateowner_slab);
@@ -3152,11 +3152,14 @@ nfs4_check_open_reclaim(clientid_t *clid)
 
 /* initialization to perform at module load time: */
 
-void
+int
 nfs4_state_init(void)
 {
-   int i;
+   int i, status;
 
+   status = nfsd4_init_slabs();
+   if (status)
+   return status;
for (i = 0; i < CLIENT_HASH_SIZE; i++) {
INIT_LIST_HEAD(&conf_id_hashtbl[i]);
INIT_LIST_HEAD(&conf_str_hashtbl[i]);
@@ -3185,6 +3188,7 @@ nfs4_state_init(void)
for (i = 0; i < CLIENT_HASH_SIZE; i++)
INIT_LIST_HEAD(&reclaim_str_hashtbl[i]);
reclaim_str_hashtbl_size = 0;
+   return 0;
 }
 
 static void
@@ -3245,20 +3249,15 @@ __nfs4_state_start(void)
set_max_delegations();
 }
 
-int
+void
 nfs4_state_start(void)
 {
-   int status;
-
if (nfs4_init)
-   return 0;
-   status = nfsd4_init_slabs();
-   if (status)
-   return status;
+   return;
nfsd4_load_reboot_recovery_data();
__nfs4_state_start();
nfs4_init = 1;
-   return 0;
+   return;
 }
 
 int
@@ -3316,7 +3315,6 @@ nfs4_state_shutdown(void)
nfs4_lock_state();
nfs4_release_reclaim();
__nfs4_state_shutdown();
-   nfsd4_free_slabs();
nfs4_unlock_state();
 }
 
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index baac89d..d135f5f 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -679,11 +679,13 @@ static int __init init_nfsd(void)
int retval;
printk(KERN_INFO "Installing knfsd (copyright (C) 1996 [EMAIL 
PROTECTED]).\n");
 
+   retval = nfs4_state_init(); /* nfs4 locking state */
+   if (retval)
+   return retval;
nfsd_stat_init();   /* Statistics */
nfsd_cache_init();  /* RPC reply cache */
nfsd_export_init(); /* Exports table */
nfsd_lockd_init();  /* lockd->nfsd callbacks */
-   nfs4_state_init();  /* NFSv4 locking state */
nfsd_idmap_init();  /* Name to ID mapping */
if (proc_mkdir("fs/nfs", NULL)) {
struct proc_dir_entry *entry;
@@ -712,6 +714,7 @@ static void __exit exit_nfsd(void)
nfsd_stat_shutdown();
nfsd_lockd_shutdown();
nfsd_idmap_shutdown();
+   nfsd4_free_slabs();
unregister_filesystem(&nfsd_fs_type);
 }
 
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index ef46f32..1190aea 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -349,9 +349,7 @@ nfsd_svc(unsigned short port, int nrservs)
error = nfsd_racache_init(2*nrservs);
if (error<0)
goto out;
-   error = nfs4_state_start();
-   if (error<0)
-   goto out;
+   nfs4_state_start();
 
nfsd_reset_versions();
 
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index e452256..604a0d7 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -153,19 +153,21 @@ extern int nfsd_max_blksize;
  */
 #ifdef CONFIG_NFSD_V4
 extern unsigned int max_delegations;
-void nfs4_state_init(void);
-int nfs4_state_start(void);
+int nfs4_state_init(void);
+void nfsd4_free_slabs(void);
+void nfs4_state_start(void);
 void nfs4_state_shutdown(void);
 time_t nfs4_lease_time(void);
 void nfs4_reset_lease(time_t leasetime);
 int nfs4_reset_recoverydir(char *recdir);
 #else
-static inline void nfs4_state_init(void){};
-static inline int nfs4_state_start(void){return 0;}
-static inline void nfs4_state_shutdown(void){}
-static inline time_t nfs4_lease_time(void){return 0;}
-static inline void nfs4_reset_lease(time_t leasetime){}
-static inline int nfs4_reset_recoverydir(char *recdir) {return 0;}
+static inline int nfs4_state_init(void) { return 0; }
+static inline void nfsd4_free_slabs(void) { }
+static inline void nfs4_state_start(void) { }
+static inline void nfs4_state_shutdown(void) { }
+static inline time_t nfs4_lease_time(void) { return 0; }
+static inline void nfs4_reset_lease(time_t lea

[PATCH 12/15] nfsd warning fix

2007-08-27 Thread J. Bruce Fields
From: Andrew Morton <[EMAIL PROTECTED]>

fs/nfsd/nfsctl.c: In function 'write_filehandle':
fs/nfsd/nfsctl.c:301: warning: 'maxsize' may be used uninitialized in this 
function

Cc: Neil Brown <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfsctl.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index d135f5f..77dc989 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -298,7 +298,7 @@ static ssize_t write_filehandle(struct file *file, char 
*buf, size_t size)
 * qword quoting is used, so filehandle will be \x
 */
char *dname, *path;
-   int maxsize;
+   int uninitialized_var(maxsize);
char *mesg = buf;
int len;
struct auth_domain *dom;
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/15] svcgss: move init code into separate function

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

We've let svcauth_gss_accept() get much too long and hairy.  The
RPC_GSS_PROC_INIT and RPC_GSS_PROC_CONTINUE_INIT cases share very little
with the other cases, so it's very natural to split them off into a
separate function.

This will also nicely isolate the piece of code we need to parametrize
to authenticating gss-protected NFSv4 callbacks on behalf of the NFS
client.

Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
---
 net/sunrpc/auth_gss/svcauth_gss.c |  144 -
 1 files changed, 77 insertions(+), 67 deletions(-)

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c 
b/net/sunrpc/auth_gss/svcauth_gss.c
index dc2f41e..79a507e 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -632,7 +632,8 @@ svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o)
return 0;
 }
 
-/* Verify the checksum on the header and return SVC_OK on success.
+/*
+ * Verify the checksum on the header and return SVC_OK on success.
  * Otherwise, return SVC_DROP (in the case of a bad sequence number)
  * or return SVC_DENIED and indicate error in authp.
  */
@@ -962,6 +963,78 @@ gss_write_init_verf(struct svc_rqst *rqstp, struct rsi 
*rsip)
 }
 
 /*
+ * Having read the cred already and found we're in the context
+ * initiation case, read the verifier and initiate (or check the results
+ * of) upcalls to userspace for help with context initiation.  If
+ * the upcall results are available, write the verifier and result.
+ * Otherwise, drop the request pending an answer to the upcall.
+ */
+static int svcauth_gss_handle_init(struct svc_rqst *rqstp,
+   struct rpc_gss_wire_cred *gc, __be32 *authp)
+{
+   struct kvec *argv = &rqstp->rq_arg.head[0];
+   struct kvec *resv = &rqstp->rq_res.head[0];
+   struct xdr_netobj tmpobj;
+   struct rsi *rsip, rsikey;
+
+   /* Read the verifier; should be NULL: */
+   *authp = rpc_autherr_badverf;
+   if (argv->iov_len < 2 * 4)
+   return SVC_DENIED;
+   if (svc_getnl(argv) != RPC_AUTH_NULL)
+   return SVC_DENIED;
+   if (svc_getnl(argv) != 0)
+   return SVC_DENIED;
+
+   /* Martial context handle and token for upcall: */
+   *authp = rpc_autherr_badcred;
+   if (gc->gc_proc == RPC_GSS_PROC_INIT && gc->gc_ctx.len != 0)
+   return SVC_DENIED;
+   memset(&rsikey, 0, sizeof(rsikey));
+   if (dup_netobj(&rsikey.in_handle, &gc->gc_ctx))
+   return SVC_DROP;
+   *authp = rpc_autherr_badverf;
+   if (svc_safe_getnetobj(argv, &tmpobj)) {
+   kfree(rsikey.in_handle.data);
+   return SVC_DENIED;
+   }
+   if (dup_netobj(&rsikey.in_token, &tmpobj)) {
+   kfree(rsikey.in_handle.data);
+   return SVC_DROP;
+   }
+
+   /* Perform upcall, or find upcall result: */
+   rsip = rsi_lookup(&rsikey);
+   rsi_free(&rsikey);
+   if (!rsip)
+   return SVC_DROP;
+   switch (cache_check(&rsi_cache, &rsip->h, &rqstp->rq_chandle)) {
+   case -EAGAIN:
+   case -ETIMEDOUT:
+   case -ENOENT:
+   /* No upcall result: */
+   return SVC_DROP;
+   case 0:
+   /* Got an answer to the upcall; use it: */
+   if (gss_write_init_verf(rqstp, rsip))
+   return SVC_DROP;
+   if (resv->iov_len + 4 > PAGE_SIZE)
+   return SVC_DROP;
+   svc_putnl(resv, RPC_SUCCESS);
+   if (svc_safe_putnetobj(resv, &rsip->out_handle))
+   return SVC_DROP;
+   if (resv->iov_len + 3 * 4 > PAGE_SIZE)
+   return SVC_DROP;
+   svc_putnl(resv, rsip->major_status);
+   svc_putnl(resv, rsip->minor_status);
+   svc_putnl(resv, GSS_SEQ_WIN);
+   if (svc_safe_putnetobj(resv, &rsip->out_token))
+   return SVC_DROP;
+   }
+   return SVC_COMPLETE;
+}
+
+/*
  * Accept an rpcsec packet.
  * If context establishment, punt to user space
  * If data exchange, verify/decrypt
@@ -975,11 +1048,9 @@ svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp)
struct kvec *argv = &rqstp->rq_arg.head[0];
struct kvec *resv = &rqstp->rq_res.head[0];
u32 crlen;
-   struct xdr_netobj tmpobj;
struct gss_svc_data *svcdata = rqstp->rq_auth_data;
struct rpc_gss_wire_cred *gc;
struct rsc  *rsci = NULL;
-   struct rsi  *rsip, rsikey;
__be32  *rpcstart;
__be32  *reject_stat = resv->iov_base + resv->iov_len;
int ret;
@@ -1024,30 +1095,14 @@ svcauth_gss_accept(struct svc_rqst *rqstp, __be32 
*authp)
if ((gc->gc_proc != RPC_GSS_PROC_DATA) && (rqstp->rq_proc != 0))
goto auth_err;
 
-   /*
-* We've successfully parsed th

[PATCH 15/15] knfsd: 64 bit ino support for NFS server

2007-08-27 Thread J. Bruce Fields
From: Peter Staubach <[EMAIL PROTECTED]>

Modify the NFS server code to support 64 bit ino's, as
appropriate for the system and the NFS protocol version.

The gist of the changes is to query the underlying file system
for attributes and not just to use the cached attributes in the
inode.  For this specific purpose, the inode only contains an
ino field which unsigned long, which is large enough on 64 bit
platforms, but is not large enough on 32 bit platforms.

I haven't been able to find any reason why ->getattr can't be called
while i_mutex.  The specification indicates that i_mutex is not
required to be held in order to invoke ->getattr, but it doesn't say
that i_mutex can't be held while invoking ->getattr.

I also haven't come to any conclusions regarding the value of
lease_get_mtime() and whether it should or should not be invoked
by fill_post_wcc() too.  I chose not to change this because I
thought that it was safer to leave well enough alone.  If we
decide to make a change, it can be done separately.

Signed-off-by: Peter Staubach <[EMAIL PROTECTED]>
Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
---
 fs/nfsd/nfs3xdr.c  |   59 ---
 fs/nfsd/nfs4xdr.c  |   17 ++--
 fs/nfsd/nfsxdr.c   |4 +++
 include/linux/nfsd/nfsfh.h |   42 +++
 include/linux/nfsd/xdr4.h  |4 +-
 5 files changed, 45 insertions(+), 81 deletions(-)

diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 10f6e7d..2d116d2 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -174,9 +174,6 @@ static __be32 *
 encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
  struct kstat *stat)
 {
-   struct dentry   *dentry = fhp->fh_dentry;
-   struct timespec time;
-
*p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
*p++ = htonl((u32) stat->mode);
*p++ = htonl((u32) stat->nlink);
@@ -191,10 +188,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct 
svc_fh *fhp,
*p++ = htonl((u32) MAJOR(stat->rdev));
*p++ = htonl((u32) MINOR(stat->rdev));
p = encode_fsid(p, fhp);
-   p = xdr_encode_hyper(p, (u64) stat->ino);
+   p = xdr_encode_hyper(p, stat->ino);
p = encode_time3(p, &stat->atime);
-   lease_get_mtime(dentry->d_inode, &time); 
-   p = encode_time3(p, &time);
+   p = encode_time3(p, &stat->mtime);
p = encode_time3(p, &stat->ctime);
 
return p;
@@ -203,31 +199,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct 
svc_fh *fhp,
 static __be32 *
 encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
 {
-   struct inode*inode = fhp->fh_dentry->d_inode;
-
/* Attributes to follow */
*p++ = xdr_one;
-
-   *p++ = htonl(nfs3_ftypes[(fhp->fh_post_mode & S_IFMT) >> 12]);
-   *p++ = htonl((u32) fhp->fh_post_mode);
-   *p++ = htonl((u32) fhp->fh_post_nlink);
-   *p++ = htonl((u32) nfsd_ruid(rqstp, fhp->fh_post_uid));
-   *p++ = htonl((u32) nfsd_rgid(rqstp, fhp->fh_post_gid));
-   if (S_ISLNK(fhp->fh_post_mode) && fhp->fh_post_size > NFS3_MAXPATHLEN) {
-   p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
-   } else {
-   p = xdr_encode_hyper(p, (u64) fhp->fh_post_size);
-   }
-   p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9);
-   *p++ = fhp->fh_post_rdev[0];
-   *p++ = fhp->fh_post_rdev[1];
-   p = encode_fsid(p, fhp);
-   p = xdr_encode_hyper(p, (u64) inode->i_ino);
-   p = encode_time3(p, &fhp->fh_post_atime);
-   p = encode_time3(p, &fhp->fh_post_mtime);
-   p = encode_time3(p, &fhp->fh_post_ctime);
-
-   return p;
+   return encode_fattr3(rqstp, p, fhp, &fhp->fh_post_attr);
 }
 
 /*
@@ -246,6 +220,7 @@ encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, 
struct svc_fh *fhp)
err = vfs_getattr(fhp->fh_export->ex_mnt, dentry, &stat);
if (!err) {
*p++ = xdr_one; /* attributes follow */
+   lease_get_mtime(dentry->d_inode, &stat.mtime);
return encode_fattr3(rqstp, p, fhp, &stat);
}
}
@@ -284,6 +259,23 @@ encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct 
svc_fh *fhp)
return encode_post_op_attr(rqstp, p, fhp);
 }
 
+/*
+ * Fill in the post_op attr for the wcc data
+ */
+void fill_post_wcc(struct svc_fh *fhp)
+{
+   int err;
+
+   if (fhp->fh_post_saved)
+   printk("nfsd: inode locked twice during operation.\n");
+
+   err = vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry,
+   &fhp->fh_post_attr);
+   if (err)
+   fhp->fh_post_saved = 0;
+   else
+   fhp->fh_post_saved = 1;
+}
 
 /*
  * XDR decode functions
@@ -643,8 +635,11 @@ int
 nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
   

[PATCH 08/15] knfsd: spawn kernel thread to probe callback channel

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

We want to allow gss on the callback channel, so people using krb5 can
still get the benefits of delegations.

But looking up the rpc credential can take some time in that case.  And
we shouldn't delay the response to setclientid_confirm while we wait.

It may be inefficient, but for now the simplest solution is just to
spawn a new thread as necessary for the purpose.

(Thanks to Adrian Bunk for catching a missing static here.)

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
Cc: Adrian Bunk <[EMAIL PROTECTED]>
---
 fs/nfsd/nfs4callback.c |   71 +++-
 1 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 31d6633..c17a520 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -365,6 +366,35 @@ nfsd4_lookupcred(struct nfs4_client *clp, int taskflags)
 return ret;
 }
 
+/* Reference counting, callback cleanup, etc., all look racy as heck.
+ * And why is cb_set an atomic? */
+
+static int do_probe_callback(void *data)
+{
+   struct nfs4_client *clp = data;
+   struct nfs4_callback *cb = &clp->cl_callback;
+   struct rpc_message msg = {
+   .rpc_proc   = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL],
+   .rpc_argp   = clp,
+   };
+   int status;
+
+   msg.rpc_cred = nfsd4_lookupcred(clp, 0);
+   if (IS_ERR(msg.rpc_cred))
+   goto out;
+   status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT);
+   put_rpccred(msg.rpc_cred);
+
+   if (status) {
+   rpc_shutdown_client(cb->cb_client);
+   cb->cb_client = NULL;
+   } else
+   atomic_set(&cb->cb_set, 1);
+out:
+   put_nfs4_client(clp);
+   return 0;
+}
+
 /*
  * Set up the callback client and put a NFSPROC4_CB_NULL on the wire...
  */
@@ -390,11 +420,7 @@ nfsd4_probe_callback(struct nfs4_client *clp)
.authflavor = RPC_AUTH_UNIX,/* XXX: need 
AUTH_GSS... */
.flags  = (RPC_CLNT_CREATE_NOPING),
};
-   struct rpc_message msg = {
-   .rpc_proc   = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL],
-   .rpc_argp   = clp,
-   };
-   int status;
+   struct task_struct *t;
 
if (atomic_read(&cb->cb_set))
return;
@@ -426,16 +452,11 @@ nfsd4_probe_callback(struct nfs4_client *clp)
/* the task holds a reference to the nfs4_client struct */
atomic_inc(&clp->cl_count);
 
-   msg.rpc_cred = nfsd4_lookupcred(clp,0);
-   if (IS_ERR(msg.rpc_cred))
-   goto out_release_clp;
-   status = rpc_call_async(cb->cb_client, &msg, RPC_TASK_ASYNC, 
&nfs4_cb_null_ops, NULL);
-   put_rpccred(msg.rpc_cred);
+   t = kthread_run(do_probe_callback, clp, "nfs4_cb_probe");
 
-   if (status != 0) {
-   dprintk("NFSD: asynchronous NFSPROC4_CB_NULL failed!\n");
+   if (IS_ERR(t))
goto out_release_clp;
-   }
+
return;
 
 out_release_clp:
@@ -447,30 +468,6 @@ out_err:
(int)clp->cl_name.len, clp->cl_name.data);
 }
 
-static void
-nfs4_cb_null(struct rpc_task *task, void *dummy)
-{
-   struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp;
-   struct nfs4_callback *cb = &clp->cl_callback;
-   __be32 addr = htonl(cb->cb_addr);
-
-   dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status);
-
-   if (task->tk_status < 0) {
-   dprintk("NFSD: callback establishment to client %.*s failed\n",
-   (int)clp->cl_name.len, clp->cl_name.data);
-   goto out;
-   }
-   atomic_set(&cb->cb_set, 1);
-   dprintk("NFSD: callback set to client %u.%u.%u.%u\n", NIPQUAD(addr));
-out:
-   put_nfs4_client(clp);
-}
-
-static const struct rpc_call_ops nfs4_cb_null_ops = {
-   .rpc_call_done = nfs4_cb_null,
-};
-
 /*
  * called with dp->dl_count inc'ed.
  * nfs4_lock_state() may or may not have been called.
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/15] nfsd: fix horrible indentation in nfsd_setattr

2007-08-27 Thread J. Bruce Fields
From: Christoph Hellwig <[EMAIL PROTECTED]>

Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
---
 fs/nfsd/vfs.c |   43 ++-
 1 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index a0c2b25..11ae949 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -294,7 +294,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, 
struct iattr *iap,
if (!iap->ia_valid)
goto out;
 
-   /* NFSv2 does not differentiate between "set-[ac]time-to-now"
+   /*
+* NFSv2 does not differentiate between "set-[ac]time-to-now"
 * which only requires access, and "set-[ac]time-to-X" which
 * requires ownership.
 * So if it looks like it might be "set both to the same time which
@@ -307,25 +308,33 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, 
struct iattr *iap,
 */
 #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
 #defineMAX_TOUCH_TIME_ERROR (30*60)
-   if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET
-   && iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec
-   ) {
-   /* Looks probable.  Now just make sure time is in the right 
ballpark.
-* Solaris, at least, doesn't seem to care what the time request is.
-* We require it be within 30 minutes of now.
-*/
-   time_t delta = iap->ia_atime.tv_sec - get_seconds();
-   if (delta<0) delta = -delta;
-   if (delta < MAX_TOUCH_TIME_ERROR &&
-   inode_change_ok(inode, iap) != 0) {
-   /* turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME
-* this will cause notify_change to set these times to "now"
+   if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET &&
+   iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec) {
+   /*
+* Looks probable.
+*
+* Now just make sure time is in the right ballpark.
+* Solaris, at least, doesn't seem to care what the time
+* request is.  We require it be within 30 minutes of now.
 */
-   iap->ia_valid &= ~BOTH_TIME_SET;
-   }
+   time_t delta = iap->ia_atime.tv_sec - get_seconds();
+   if (delta < 0)
+   delta = -delta;
+   if (delta < MAX_TOUCH_TIME_ERROR &&
+   inode_change_ok(inode, iap) != 0) {
+   /*
+* Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME.
+* This will cause notify_change to set these times
+* to "now"
+*/
+   iap->ia_valid &= ~BOTH_TIME_SET;
+   }
}

-   /* The size case is special. It changes the file as well as the 
attributes.  */
+   /*
+* The size case is special.
+* It changes the file as well as the attributes.
+*/
if (iap->ia_valid & ATTR_SIZE) {
if (iap->ia_size < inode->i_size) {
err = nfsd_permission(rqstp, fhp->fh_export, dentry, 
MAY_TRUNC|MAY_OWNER_OVERRIDE);
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/15] knfsd: Validate filehandle type in fsid_source

2007-08-27 Thread J. Bruce Fields
From: Neil Brown <[EMAIL PROTECTED]>

fsid_source decided where to get the 'fsid' number to
return for a GETATTR based on the type of filehandle.
It can be from the device, from the fsid, or from the
UUID.

It is possible for the filehandle to be inconsistent
with the export information, so make sure the export information
actually has the info implied by the value returned by
fsid_source.

Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
Cc: "Luiz Fernando N. Capitulino" <[EMAIL PROTECTED]>
Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfsfh.c |   20 +++-
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 0eb464a..7011d62 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -566,13 +566,23 @@ enum fsid_source fsid_source(struct svc_fh *fhp)
case FSID_DEV:
case FSID_ENCODE_DEV:
case FSID_MAJOR_MINOR:
-   return FSIDSOURCE_DEV;
+   if (fhp->fh_export->ex_dentry->d_inode->i_sb->s_type->fs_flags
+   & FS_REQUIRES_DEV)
+   return FSIDSOURCE_DEV;
+   break;
case FSID_NUM:
-   return FSIDSOURCE_FSID;
-   default:
if (fhp->fh_export->ex_flags & NFSEXP_FSID)
return FSIDSOURCE_FSID;
-   else
-   return FSIDSOURCE_UUID;
+   break;
+   default:
+   break;
}
+   /* either a UUID type filehandle, or the filehandle doesn't
+* match the export.
+*/
+   if (fhp->fh_export->ex_flags & NFSEXP_FSID)
+   return FSIDSOURCE_FSID;
+   if (fhp->fh_export->ex_uuid)
+   return FSIDSOURCE_UUID;
+   return FSIDSOURCE_DEV;
 }
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/15] knfsd: remove code duplication in nfsd4_setclientid()

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

Each branch of this if-then-else has a bunch of duplicated code that we
could just put at the end.

Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/nfsd/nfs4state.c |   30 ++
 1 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 09573b9..6256492 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -774,13 +774,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct 
nfsd4_compound_state *cstate,
new = create_client(clname, dname);
if (new == NULL)
goto out;
-   copy_verf(new, &clverifier);
-   new->cl_addr = sin->sin_addr.s_addr;
-   copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new);
-   gen_confirm(new);
-   gen_callback(new, setclid);
-   add_to_unconfirmed(new, strhashval);
} else if (same_verf(&conf->cl_verifier, &clverifier)) {
/*
 * CASE 1:
@@ -806,13 +800,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct 
nfsd4_compound_state *cstate,
new = create_client(clname, dname);
if (new == NULL)
goto out;
-   copy_verf(new,&conf->cl_verifier);
-   new->cl_addr = sin->sin_addr.s_addr;
-   copy_cred(&new->cl_cred,&rqstp->rq_cred);
copy_clid(new, conf);
-   gen_confirm(new);
-   gen_callback(new, setclid);
-   add_to_unconfirmed(new,strhashval);
} else if (!unconf) {
/*
 * CASE 2:
@@ -825,13 +813,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct 
nfsd4_compound_state *cstate,
new = create_client(clname, dname);
if (new == NULL)
goto out;
-   copy_verf(new,&clverifier);
-   new->cl_addr = sin->sin_addr.s_addr;
-   copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new);
-   gen_confirm(new);
-   gen_callback(new, setclid);
-   add_to_unconfirmed(new, strhashval);
} else if (!same_verf(&conf->cl_confirm, &unconf->cl_confirm)) {
/*  
 * CASE3:
@@ -852,19 +834,19 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct 
nfsd4_compound_state *cstate,
new = create_client(clname, dname);
if (new == NULL)
goto out;
-   copy_verf(new,&clverifier);
-   new->cl_addr = sin->sin_addr.s_addr;
-   copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new);
-   gen_confirm(new);
-   gen_callback(new, setclid);
-   add_to_unconfirmed(new, strhashval);
} else {
/* No cases hit !!! */
status = nfserr_inval;
goto out;
 
}
+   copy_verf(new, &clverifier);
+   new->cl_addr = sin->sin_addr.s_addr;
+   copy_cred(&new->cl_cred, &rqstp->rq_cred);
+   gen_confirm(new);
+   gen_callback(new, setclid);
+   add_to_unconfirmed(new, strhashval);
setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot;
setclid->se_clientid.cl_id = new->cl_clientid.cl_id;
memcpy(setclid->se_confirm.data, new->cl_confirm.data, 
sizeof(setclid->se_confirm.data));
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/15] knfsd: fix callback rpc cred

2007-08-27 Thread J. Bruce Fields
From: J. Bruce Fields <[EMAIL PROTECTED]>

It doesn't make sense to make the callback with credentials that the
client made the setclientid with.  Instead the spec requires that the
callback occur with the credentials the client authenticated *to*.
It probably doesn't matter what we use for auth_unix, and some more
infrastructure will be needed for auth_gss, so let's just remove the
cred lookup for now.

Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
---
 fs/nfsd/nfs4callback.c |   33 -
 1 files changed, 0 insertions(+), 33 deletions(-)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index c17a520..c1cb7e0 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -344,28 +344,6 @@ static struct rpc_version *nfs_cb_version[] = {
&nfs_cb_version4,
 };
 
-/*
- * Use the SETCLIENTID credential
- */
-static struct rpc_cred *
-nfsd4_lookupcred(struct nfs4_client *clp, int taskflags)
-{
-struct auth_cred acred;
-   struct rpc_clnt *clnt = clp->cl_callback.cb_client;
-   struct rpc_cred *ret;
-
-get_group_info(clp->cl_cred.cr_group_info);
-acred.uid = clp->cl_cred.cr_uid;
-acred.gid = clp->cl_cred.cr_gid;
-acred.group_info = clp->cl_cred.cr_group_info;
-
-dprintk("NFSD: looking up %s cred\n",
-clnt->cl_auth->au_ops->au_name);
-ret = rpcauth_lookup_credcache(clnt->cl_auth, &acred, taskflags);
-put_group_info(clp->cl_cred.cr_group_info);
-return ret;
-}
-
 /* Reference counting, callback cleanup, etc., all look racy as heck.
  * And why is cb_set an atomic? */
 
@@ -379,18 +357,13 @@ static int do_probe_callback(void *data)
};
int status;
 
-   msg.rpc_cred = nfsd4_lookupcred(clp, 0);
-   if (IS_ERR(msg.rpc_cred))
-   goto out;
status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT);
-   put_rpccred(msg.rpc_cred);
 
if (status) {
rpc_shutdown_client(cb->cb_client);
cb->cb_client = NULL;
} else
atomic_set(&cb->cb_set, 1);
-out:
put_nfs4_client(clp);
return 0;
 }
@@ -488,10 +461,6 @@ nfsd4_cb_recall(struct nfs4_delegation *dp)
if ((!atomic_read(&clp->cl_callback.cb_set)) || !clnt)
return;
 
-   msg.rpc_cred = nfsd4_lookupcred(clp, 0);
-   if (IS_ERR(msg.rpc_cred))
-   goto out;
-
cbr->cbr_trunc = 0; /* XXX need to implement truncate optimization */
cbr->cbr_dp = dp;
 
@@ -512,8 +481,6 @@ nfsd4_cb_recall(struct nfs4_delegation *dp)
status = rpc_call_sync(clnt, &msg, RPC_TASK_SOFT);
}
 out_put_cred:
-   put_rpccred(msg.rpc_cred);
-out:
if (status == -EIO)
atomic_set(&clp->cl_callback.cb_set, 0);
/* Success or failure, now we're either waiting for lease expiration
-- 
1.5.3.rc5.19.g0734d

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] export __put_task_struct for XPMEM

2007-08-27 Thread Robin Holt
On Mon, Aug 27, 2007 at 08:35:10PM +0100, Al Viro wrote:
> On Mon, Aug 27, 2007 at 02:19:06PM -0500, Dean Nelson wrote:
> 
> > No operations can be done once it's closed, only while it's opened.
> 
> What the hell do you mean, can't be done?
> 
>   fd = open(...);
>   fp = popen("/bin/date", "r");
>   /* read from fp */
>   fclose(fp);

But this will operate on the dup'd fd.  We detect that in the flush
(ignore) and ioctl (return errors) operations.  All other operations
are not handled by xpmem.

If you look at the fourth patch, at the beginning of the xpmem_flush
function, we have:

+   tg = xpmem_tg_ref_by_tgid(xpmem_my_part, current->tgid);
+   if (IS_ERR(tg))
+   return 0;  /* probably child process who inherited fd */

This will protect the xpmem structures of the parent from closes by
the child.

Thanks,
Robin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] SLUB: use have_arch_cmpxchg()

2007-08-27 Thread Mathieu Desnoyers
* Christoph Lameter ([EMAIL PROTECTED]) wrote:
> On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:
> 
> > Hrm, actually, I don't think such have_arch_cmpxchg() macro will be
> > required at all because of the small performance hit disabling
> > preemption will have on the slow and fast paths. Let's compare, for each
> > of the slow path and fast path, what locking looks like on architecture
> > with and without local cmpxchg:
> > 
> > What we actually do here is:
> > 
> > fast path:
> > with local_cmpxchg:
> >   preempt_disable()
> >   preempt_enable()
> > without local_cmpxchg:
> >   preempt_disable()
> >   local_irq_save
> >   local_irq_restore
> >   preempt_enable()
> > (we therefore disable preemption _and_ disable interrupts for
> > nothing)
> 
> Hmmm. This is a performance issue for preempt kernels.
> 
> > slow path:
> > both with and without local_cmpxchg():
> >   preempt_disable()
> >   preempt_enable()
> 
> Here we potentially loose our per cpu structure since the process may be 
> rescheduled.
> 

Yes, what you do here is more precisely:

  preempt_disable()
  local_irq_save()
  preempt_enable_no_resched()
  ...
  local_irq_restore()
  preempt_check_resched()


> >   local_irq_save()
> >   local_irq_restore()
> > 
> > 
> > Therefore, we would add preempt disable/enable to the fast path of
> > architectures where local_cmpxchg is emulated with irqs off. But since
> > preempt disable/enable is just a check counter increment/decrement with
> > barrier() and thread flag check, I doubt it would hurt performances
> > enough to justify the added complexity of disabling interrupts for the
> > whole fast path in this case.
> 
> One additional cacheline referenced in the hot path. Ok the counter may be 
> hot as well if this is a preemptible kernel. Nevertheless a cause for 
> concern.
> 

If kernel is non preemptible, the macros preempt_*() are defined to
nothing. And as you say, on preemptible kernels, these variables (thread
flags and preempt count) are very likely to be in cache, since they are
in the thread info struct, but it should still be kept in mind.

Mathieu

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] SLUB use cmpxchg_local

2007-08-27 Thread Christoph Lameter
On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:

> * Christoph Lameter ([EMAIL PROTECTED]) wrote:
> > On Mon, 27 Aug 2007, Peter Zijlstra wrote:
> > 
> > > So, if the fast path can be done with a preempt off, it might be doable
> > > to suffer the slow path with a per cpu lock like that.
> > 
> > Sadly the cmpxchg_local requires local per cpu data access. Isnt there 
> > some way to make this less expensive on RT? Acessing cpu local memory is 
> > really good for performance on NUMA since the data is optimally placed and 
> > one can avoid/reduce locking if the process stays tied to the processor.
> > 
> 
> On the slow path, in slab_new, we already have to reenable interrupts
> because we can sleep. If we make sure that whenever we return to an irq
> disable code path we take the current per-cpu data structure again, can
> we make the preempt-disable/irq-disabled code paths O(1) ?

Not sure exactly what you are getting at?
This would mean running __alloc_pages tied to one processor even though 
waiting is possible?


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: "double" hpet clocksource && hard freeze [bisected]

2007-08-27 Thread Luiz Fernando N. Capitulino
Em Fri, 24 Aug 2007 11:17:34 -0700
john stultz <[EMAIL PROTECTED]> escreveu:

| On Fri, 2007-08-24 at 08:46 -0400, Bob Picco wrote:
| > john stultz wrote:  [Thu Aug 23 2007, 05:41:45PM EDT]
| > > On Thu, 2007-08-23 at 14:05 -0700, john stultz wrote:
| > > > On Thu, 2007-08-23 at 13:41 -0700, Luck, Tony wrote:
| > > > > > I have a double "hpet" entry in "available_clocksource":
| > > > > > $ cat 
/sys/devices/system/clocksource/clocksource0/available_clocksource
| > > > > > tsc hpet hpet acpi_pm jiffies
| > > > > 
| > > > > Oops.  If seems that both drivers/char/hpet.c and 
arch/x86_64/kernel/hpet.c
| > > > > both register a clocksource named "hpet".  Probably a result of 
bringing
| > > > > back to life a long lost patch, and having someone else (John Stultz, 
according
| > > > > to git blame) make a similar change to a different file in the 
intervening
| > > > > time.
| > > > > 
| > > > > Presumably the thing to do would be merge the x86_64 specific version
| > > > > into the drivers/char/hpet.c version?
| > > > 
| > > > Ugh. Yea. i386 has an hpet clocksource as well. We should kill the
| > > > duplication, but at the moment I'm not comfortable that the
| > > > driver/char/hpet.c is ok to be used for i386/x86_64 (Bob: Do you know
| > > > why the shift value is only 10?).
| > > > 
| > > > 
| > > > I'm a little surprised by this, as the clocksource code use to prevent
| > > > duplicate named clocksources from being registered, so I'm not sure how
| > > > that check got dropped.  Also I'm not quite sure I see where the hard
| > > > freeze is coming from.
| > > > 
| > > > My initial reaction would be to either ifdef ia64 implementation in
| > > > drivers/char/hpet.c or move the code under the ia64 arch dir until it is
| > > > really usable by all arches.
| > > 
| > > Here is a possible quick fix. I'm open to other approaches, but I also
| > > want to avoid too much churn before 2.6.23 goes out.
| > > 
| > > Paolo, could you verify this fixes the issue for you?
| > > 
| > > thanks
| > > -john
| > > 
| > [snip]
| > 
| > I saw what was missed by me in my brief examination of this last night.
| > The platform registers the hpet clocksource too.
| > 
| > Instead of adding the config flag to hpet driver, how about the patch
| > below? Since you already check for duplication by address then adding
| > a check for by name too seems okay to me.
| > 
| > bob
| > 
| > 
| > Prevent duplicate names being registered with clocksource. This also
| > eliminates the duplication of hpet clock registration when the arch
| > uses the hpet timer and the hpet driver does too. The patch was
| > compile and link tested.
| 
| Yea. While I'm still not completely comfortable leaving this up to boot
| order alone (the ia64 hpet clocksource is clearly causing issues on
| x86_64), I think this patch is something we need as well.

 Does -stable need this too?

-- 
Luiz Fernando N. Capitulino
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] fix bogus hotplug cpu warning

2007-08-27 Thread Hugh Dickins
On Mon, 27 Aug 2007, Andrew Morton wrote:
> On Mon, 27 Aug 2007 16:06:19 +0100 (BST)
> Hugh Dickins <[EMAIL PROTECTED]> wrote:
> 
> > Fix bogus DEBUG_PREEMPT warning on x86_64, when cpu brought online after
> > bootup: current_is_keventd is right to note its use of smp_processor_id
> > is preempt-safe, but should use raw_smp_processor_id to avoid the warning.
> > 
> > Signed-off-by: Hugh Dickins <[EMAIL PROTECTED]>
> > 
> > --- 2.6.23-rc3-git10/kernel/workqueue.c 2007-07-26 19:49:58.0 
> > +0100
> > +++ linux/kernel/workqueue.c2007-08-26 18:59:16.0 +0100
> > @@ -635,7 +635,7 @@ int keventd_up(void)
> >  int current_is_keventd(void)
> >  {
> > struct cpu_workqueue_struct *cwq;
> > -   int cpu = smp_processor_id();   /* preempt-safe: keventd is per-cpu */
> > +   int cpu = raw_smp_processor_id(); /* preempt-safe: keventd is per-cpu */
> > int ret = 0;
> >  
> > BUG_ON(!keventd_wq);
> 
> But lib/smp_processor_id.c:debug_smp_processor_id() does
> 
>   /*
>* Kernel threads bound to a single CPU can safely use
>* smp_processor_id():
>*/
>   this_mask = cpumask_of_cpu(this_cpu);
> 
>   if (cpus_equal(current->cpus_allowed, this_mask))
>   goto out;
> 
> So I assume that this warning was triggering because some non-keventd,
> non-pinned task is calling current_is_keventd()?

That's right, the x86_64 (and the ia64) do_boot_cpu() functions (called
when onlining a cpu) do a check on current_is_keventd(): commented thus
 * During cold boot process, keventd thread is not spun up yet.
 * When we do cpu hot-add, we create idle threads on the fly, we should
 * not acquire any attributes from the calling context. Hence the clean
 * way to create kernel_threads() is to do that from keventd().
 * We do the current_is_keventd() due to the fact that ACPI notifier
 * was also queuing to keventd() and when the caller is already running
 * in context of keventd(), we would end up with locking up the keventd
 * thread.
though I've not tried to think that through.

> So I agree with the patch, but not with its description.

I don't see which part of the description you disagree with, but please
do improve it if you can.  The actual trace (when powersaved was saving
power by onlining a cpu I'd tried to exclude with maxcpus=1 ;) was this:

 BUG: using smp_processor_id() in preemptible [0001] code: powersaved/3368
 caller is current_is_keventd+0x9/0x3d
 
 Call Trace:
  [] debug_smp_processor_id+0xc1/0xd4
  [] current_is_keventd+0x9/0x3d
  [] do_boot_cpu+0x19e/0x3c9
  [] do_fork_idle+0x0/0x29
  [] __cpu_up+0xd4/0x107
  [] _cpu_up+0xd9/0x17a
  [] cpu_up+0x36/0x4d
  [] store_online+0x52/0x81
  [] sysdev_store+0x3c/0x3e
  [] flush_write_buffer+0x63/0x81
  [] sysfs_write_file+0x69/0x8f
  [] _spin_unlock_irqrestore+0x16/0x30
  [] vfs_write+0xc5/0x186
  [] up_write+0xd/0xf
  [] sys_write+0x51/0x7a
  [] system_call+0x7e/0x83

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: RFC: issues concerning the next NAPI interface

2007-08-27 Thread David Miller
From: Jan-Bernd Themann <[EMAIL PROTECTED]>
Date: Mon, 27 Aug 2007 11:47:01 +0200

> So the question is simply: Do we want drivers that need (benefit
> from) a timer based polling support to implement their own timers
> each, or should there be a generic support?

I'm trying to figure out how an hrtimer implementation would
even work.

Would you start the timer from the chip interrupt handler?  If so,
that's taking two steps backwards as you've already taken all of the
overhead of running the interrupt handler.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] SLUB use cmpxchg_local

2007-08-27 Thread Mathieu Desnoyers
* Christoph Lameter ([EMAIL PROTECTED]) wrote:
> On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:
> 
> > * Christoph Lameter ([EMAIL PROTECTED]) wrote:
> > > On Mon, 27 Aug 2007, Peter Zijlstra wrote:
> > > 
> > > > So, if the fast path can be done with a preempt off, it might be doable
> > > > to suffer the slow path with a per cpu lock like that.
> > > 
> > > Sadly the cmpxchg_local requires local per cpu data access. Isnt there 
> > > some way to make this less expensive on RT? Acessing cpu local memory is 
> > > really good for performance on NUMA since the data is optimally placed 
> > > and 
> > > one can avoid/reduce locking if the process stays tied to the processor.
> > > 
> > 
> > On the slow path, in slab_new, we already have to reenable interrupts
> > because we can sleep. If we make sure that whenever we return to an irq
> > disable code path we take the current per-cpu data structure again, can
> > we make the preempt-disable/irq-disabled code paths O(1) ?
> 
> Not sure exactly what you are getting at?
> This would mean running __alloc_pages tied to one processor even though 
> waiting is possible?
> 

Not exactly. What I propose is:

- Running slab_alloc and slab_free fast paths in preempt_disable
  context, using cmpxchg_local.
- Running slab_alloc and slab_free slow paths with irqs disabled.
- Running __alloc_pages in preemptible context, not tied to any CPU.

In this scheme, calling __alloc_pages from slab_alloc would reenable
interrupts and potentially migrate us to a different CPU. We would
therefore have to get once again our per-cpu data structure once we get
back into irq disabled code, because we may be running on a different
CPU. This is actually what the __slab_alloc slow path does:


new_slab:
new = get_partial(s, gfpflags, node);
if (new) {
c->page = new;
goto load_freelist;
}

new = new_slab(s, gfpflags, node);

  > within new_slab, we can reenable interrupts for the
__slab_alloc call.

if (new) {
c = get_cpu_slab(s, smp_processor_id());
if (c->page) {
/*
 * Someone else populated the cpu_slab while we
 * enabled interrupts, or we have gotten scheduled
 * on another cpu. The page may not be on the
 * requested node even if __GFP_THISNODE was
 * specified. So we need to recheck.
 */
if (node_match(c, node)) {
/*
 * Current cpuslab is acceptable and we
 * want the current one since its cache hot
 */
discard_slab(s, new);
slab_lock(c->page);
goto load_freelist;
}
/* New slab does not fit our expectations */
flush_slab(s, c);
}
slab_lock(new);
SetSlabFrozen(new);
c->page = new;
goto load_freelist;

So the idea would be to split the code in O(1)
preempt_disable/irq_disable sections and to enable interrupt and check
for current per-cpu data structure when re-entering in irq disabled
code.

Mathieu

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] trivial - constify sched.h

2007-08-27 Thread Joe Perches
Add const to some struct task_struct * uses

Signed-off-by: Joe Perches <[EMAIL PROTECTED]>

---

 include/linux/sched.h |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index ba78807..71d40a1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1222,22 +1222,22 @@ static inline int rt_prio(int prio)
return 0;
 }
 
-static inline int rt_task(struct task_struct *p)
+static inline int rt_task(const struct task_struct *p)
 {
return rt_prio(p->prio);
 }
 
-static inline pid_t process_group(struct task_struct *tsk)
+static inline pid_t process_group(const struct task_struct *tsk)
 {
return tsk->signal->pgrp;
 }
 
-static inline pid_t signal_session(struct signal_struct *sig)
+static inline pid_t signal_session(const struct signal_struct *sig)
 {
return sig->__session;
 }
 
-static inline pid_t process_session(struct task_struct *tsk)
+static inline pid_t process_session(const struct task_struct *tsk)
 {
return signal_session(tsk->signal);
 }
@@ -1247,22 +1247,22 @@ static inline void set_signal_session(struct 
signal_struct *sig, pid_t session)
sig->__session = session;
 }
 
-static inline struct pid *task_pid(struct task_struct *task)
+static inline struct pid *task_pid(const struct task_struct *task)
 {
return task->pids[PIDTYPE_PID].pid;
 }
 
-static inline struct pid *task_tgid(struct task_struct *task)
+static inline struct pid *task_tgid(const struct task_struct *task)
 {
return task->group_leader->pids[PIDTYPE_PID].pid;
 }
 
-static inline struct pid *task_pgrp(struct task_struct *task)
+static inline struct pid *task_pgrp(const struct task_struct *task)
 {
return task->group_leader->pids[PIDTYPE_PGID].pid;
 }
 
-static inline struct pid *task_session(struct task_struct *task)
+static inline struct pid *task_session(const struct task_struct *task)
 {
return task->group_leader->pids[PIDTYPE_SID].pid;
 }
@@ -1275,7 +1275,7 @@ static inline struct pid *task_session(struct task_struct 
*task)
  * If pid_alive fails, then pointers within the task structure
  * can be stale and must not be dereferenced.
  */
-static inline int pid_alive(struct task_struct *p)
+static inline int pid_alive(const struct task_struct *p)
 {
return p->pids[PIDTYPE_PID].pid != NULL;
 }
@@ -1286,7 +1286,7 @@ static inline int pid_alive(struct task_struct *p)
  *
  * Check if a task structure is the first user space task the kernel created.
  */
-static inline int is_init(struct task_struct *tsk)
+static inline int is_init(const struct task_struct *tsk)
 {
return tsk->pid == 1;
 }
@@ -1639,7 +1639,7 @@ extern void wait_task_inactive(struct task_struct * p);
  * all we care about is that we have a task with the appropriate
  * pid, we don't actually care if we have the right task.
  */
-static inline int has_group_leader_pid(struct task_struct *p)
+static inline int has_group_leader_pid(const struct task_struct *p)
 {
return p->pid == p->tgid;
 }
@@ -1650,7 +1650,7 @@ static inline struct task_struct *next_thread(const 
struct task_struct *p)
  struct task_struct, thread_group);
 }
 
-static inline int thread_group_empty(struct task_struct *p)
+static inline int thread_group_empty(const struct task_struct *p)
 {
return list_empty(&p->thread_group);
 }


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: CFS review

2007-08-27 Thread Ingo Molnar

* Al Boldi <[EMAIL PROTECTED]> wrote:

> > Could you try the patch below instead, does this make 3x glxgears 
> > smooth again? (if yes, could you send me your Signed-off-by line as 
> > well.)
> 
> The task-startup stalling is still there for ~10sec.
> 
> Can you see the problem on your machine?

nope (i have no framebuffer setup) - but i can see some chew-max 
latencies that occur when new tasks are started up. I _think_ it's 
probably the same problem as yours.

could you try the patch below (which is the combo patch of my current 
queue), ontop of head 50c46637aa? This makes chew-max behave better 
during task mass-startup here.

Ingo

->
Index: linux/include/linux/sched.h
===
--- linux.orig/include/linux/sched.h
+++ linux/include/linux/sched.h
@@ -904,6 +904,7 @@ struct sched_entity {
 
u64 exec_start;
u64 sum_exec_runtime;
+   u64 prev_sum_exec_runtime;
u64 wait_start_fair;
u64 sleep_start_fair;
 
Index: linux/kernel/sched.c
===
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -1587,6 +1587,7 @@ static void __sched_fork(struct task_str
p->se.wait_start_fair   = 0;
p->se.exec_start= 0;
p->se.sum_exec_runtime  = 0;
+   p->se.prev_sum_exec_runtime = 0;
p->se.delta_exec= 0;
p->se.delta_fair_run= 0;
p->se.delta_fair_sleep  = 0;
Index: linux/kernel/sched_fair.c
===
--- linux.orig/kernel/sched_fair.c
+++ linux/kernel/sched_fair.c
@@ -82,12 +82,12 @@ enum {
 };
 
 unsigned int sysctl_sched_features __read_mostly =
-   SCHED_FEAT_FAIR_SLEEPERS*1 |
+   SCHED_FEAT_FAIR_SLEEPERS*0 |
SCHED_FEAT_SLEEPER_AVG  *0 |
SCHED_FEAT_SLEEPER_LOAD_AVG *1 |
SCHED_FEAT_PRECISE_CPU_LOAD *1 |
-   SCHED_FEAT_START_DEBIT  *1 |
-   SCHED_FEAT_SKIP_INITIAL *0;
+   SCHED_FEAT_START_DEBIT  *0 |
+   SCHED_FEAT_SKIP_INITIAL *1;
 
 extern struct sched_class fair_sched_class;
 
@@ -225,39 +225,15 @@ static struct sched_entity *__pick_next_
  * Calculate the preemption granularity needed to schedule every
  * runnable task once per sysctl_sched_latency amount of time.
  * (down to a sensible low limit on granularity)
- *
- * For example, if there are 2 tasks running and latency is 10 msecs,
- * we switch tasks every 5 msecs. If we have 3 tasks running, we have
- * to switch tasks every 3.33 msecs to get a 10 msecs observed latency
- * for each task. We do finer and finer scheduling up to until we
- * reach the minimum granularity value.
- *
- * To achieve this we use the following dynamic-granularity rule:
- *
- *gran = lat/nr - lat/nr/nr
- *
- * This comes out of the following equations:
- *
- *kA1 + gran = kB1
- *kB2 + gran = kA2
- *kA2 = kA1
- *kB2 = kB1 - d + d/nr
- *lat = d * nr
- *
- * Where 'k' is key, 'A' is task A (waiting), 'B' is task B (running),
- * '1' is start of time, '2' is end of time, 'd' is delay between
- * 1 and 2 (during which task B was running), 'nr' is number of tasks
- * running, 'lat' is the the period of each task. ('lat' is the
- * sched_latency that we aim for.)
  */
-static long
+static unsigned long
 sched_granularity(struct cfs_rq *cfs_rq)
 {
unsigned int gran = sysctl_sched_latency;
unsigned int nr = cfs_rq->nr_running;
 
if (nr > 1) {
-   gran = gran/nr - gran/nr/nr;
+   gran = gran/nr;
gran = max(gran, sysctl_sched_min_granularity);
}
 
@@ -489,6 +465,9 @@ update_stats_wait_end(struct cfs_rq *cfs
 {
unsigned long delta_fair;
 
+   if (unlikely(!se->wait_start_fair))
+   return;
+
delta_fair = (unsigned long)min((u64)(2*sysctl_sched_runtime_limit),
(u64)(cfs_rq->fair_clock - se->wait_start_fair));
 
@@ -668,7 +647,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
 /*
  * Preempt the current task with a newly woken task if needed:
  */
-static void
+static int
 __check_preempt_curr_fair(struct cfs_rq *cfs_rq, struct sched_entity *se,
  struct sched_entity *curr, unsigned long granularity)
 {
@@ -679,8 +658,11 @@ __check_preempt_curr_fair(struct cfs_rq 
 * preempt the current task unless the best task has
 * a larger than sched_granularity fairness advantage:
 */
-   if (__delta > niced_granularity(curr, granularity))
+   if (__delta > niced_granularity(curr, granularity)) {
resched_task(rq_of(cfs_rq)->curr);
+   return 1

Re: [PATCH 1/4] export __put_task_struct for XPMEM

2007-08-27 Thread Al Viro
On Mon, Aug 27, 2007 at 03:24:20PM -0500, Robin Holt wrote:
> On Mon, Aug 27, 2007 at 08:35:10PM +0100, Al Viro wrote:
> > On Mon, Aug 27, 2007 at 02:19:06PM -0500, Dean Nelson wrote:
> > 
> > > No operations can be done once it's closed, only while it's opened.
> > 
> > What the hell do you mean, can't be done?
> > 
> > fd = open(...);
> > fp = popen("/bin/date", "r");
> > /* read from fp */
> > fclose(fp);
> 
> But this will operate on the dup'd fd.  We detect that in the flush
> (ignore) and ioctl (return errors) operations.  All other operations
> are not handled by xpmem.

How the hell do you detect dup'd fd?  It's identical to the original
in every respect and it doesn't have to be held by a different task.
Seriously, what you are proposing makes no sense whatsoever...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: CONFIG_HOTPLUG_CPU: kconfig bug?

2007-08-27 Thread Hugh Dickins
On Mon, 27 Aug 2007, Sam Ravnborg wrote:
> On Mon, Aug 27, 2007 at 03:54:49PM +0100, Hugh Dickins wrote:
> > Hi Roman,
> > 
> > I've noticed an oddity with CONFIG_HOTPLUG_CPU in 2.6.23-rc:
> > make oldconfig seems to turn it on even when nothing wants it,
> > increasing kernel size by about 10k; but if you then edit the
> > line out of .config and make oldconfig again, it correctly
> > offers the choice and lets it be turned off after all.
> > 
> > (I've not actually tried make anything_else_config.)
> > 
> > Attached is a 2.6.23-rc1 i386 SMP .config, CONFIG_HOTPLUG_CPU
> > not set, with which it should be easy to reproduce the issue: just
> > make oldconfig in an -rc2 or current kernel tree (being sure to
> > choose N for SUSPEND and HIBERNATION: those rightly select it).
> 
> I tried to reproduce this with no luck:
> 
> $ mv hugh .config 
> $ make 
> scripts/kconfig/conf -s arch/i386/Kconfig
> *
> * Restart config...
> *
> *
> * Power management options (ACPI, APM)
> *
> Power Management support (PM) [Y/n/?] y
>   Legacy Power Management API (DEPRECATED) (PM_LEGACY) [N/y/?] n
>   Power Management Debug Support (PM_DEBUG) [N/y/?] n
> Suspend to RAM and standby (SUSPEND) [Y/n/?] (NEW) n  <= I 
> selected 'n'
> Hibernation (aka 'suspend to disk') (HIBERNATION) [N/y/?] (NEW) n <= I 
> selected 'n'
> *
> * Fusion MPT device support
> *
> Fusion MPT ScsiHost drivers for SPI (FUSION_SPI) [Y/n/m/?] y
> Fusion MPT ScsiHost drivers for FC (FUSION_FC) [N/m/y/?] n
> Fusion MPT ScsiHost drivers for SAS (FUSION_SAS) [N/m/y/?] n
> Maximum number of scatter gather entries (16 - 128) (FUSION_MAX_SGE) [128] 128
> Fusion MPT misc device (ioctl) driver (FUSION_CTL) [N/m/y/?] n
> Fusion MPT logging facility (FUSION_LOGGING) [N/y/?] (NEW) 
> #
> # configuration written to .config
> #
>   CHK include/linux/version.h
>   CHK include/linux/utsrelease.h
> make: *** [_all] Interrupt
> 
> $ grep HOTPLUG_CPU .config
> # CONFIG_HOTPLUG_CPU is not set
> 
> If you let kbuild do a silentoldconfig then I expect
> it to be set due to SUSPEND being set.
> 
> If you can still reproduce it could you then explan the
> exect stepts to do so.
> 
> PS. I used latest -linus as of yesterday.

Interesting, thanks a lot for trying.  Doing it your way (saying
"make" without a preparatory "make oldconfig") gives me the same
result as you, CONFIG_HOTPLUG_CPU is not set.  But doing it my way
("make oldconfig" as I indicated) gives me CONFIG_HOTPLUG_CPU=y as
before - please try an explicit "make oldconfig" and I expect
you'll find the same.

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] fix bogus hotplug cpu warning

2007-08-27 Thread Andrew Morton
On Mon, 27 Aug 2007 21:37:14 +0100 (BST)
Hugh Dickins <[EMAIL PROTECTED]> wrote:

> > So I agree with the patch, but not with its description.
> 
> I don't see which part of the description you disagree with, but please
> do improve it if you can.

I'd change the description to


current_is_keventd() is a stupid load of crap.  It does

int current_is_keventd(void)
{
struct cpu_workqueue_struct *cwq;
int cpu = smp_processor_id();   /* preempt-safe: keventd is per-cpu */

but that comment (and the code itself) only make sense when
current_is_keventd() is called by keventd.  In which case thers is no point
in the function even existing!

We need to use raw_smp_processor_id() so that non-keventd (or, more
specifically, non-pinned-to-one-cpu) callers won't generate "using
smp_processor_id() in preemptible" warnings.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] fix maxcpus=N parsing

2007-08-27 Thread Hugh Dickins
On Mon, 27 Aug 2007, Linus Torvalds wrote:
> On Mon, 27 Aug 2007, Hugh Dickins wrote:
> >
> > Fix 61ec7567db103d537329b0db9a887db570431ff4: maxcpus=N is now having no
> > ...
> 
> On a totally unrelated issue:
> 
> While looking at the history in gitk and gitweb etc shows these commit 
> ID's as nice hyperlinks, I really think it's nicer for everybody if the 
> commit is also described with its "headline", so that non-git users (or 
> even git users, when just using "git log" or similar) at least can grep or 
> google for it.
> 
> So when writing descriptions, I would prefer it if people wrote them 
> something like
> 
>Commit 61ec7567db103d537329b0db9a887db570431ff4 ('ACPI: boot correctly 
>with "nosmp" or "maxcpus=0"') broke maxcpus parsing on x86[-64] ...
> 
> so that it gets both the exact commit naming and the nice hyperlinks where 
> appropriate *and* it ends up being more useful even without the links.

Agreed and noted.

> 
> Yes, it's redundant information, but since we have the useful one-line 
> descriptions, it's generally a good idea. And I really do think that it 
> tends to make the explanations read better too.
> 
> For example, in this example, I think it really made it more clear what 
> kind of change had caused the breakage. Maybe that's not always true, but 
> I suspect it's true most of the time.
> 
> I'll fix it up manually (I often do), but I thought I'd just mention this 
> stylistic issue.

Thanks.

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] trivial - constify sched.h

2007-08-27 Thread Jiri Slaby
Joe Perches napsal(a):
> Add const to some struct task_struct * uses

Does this have any impact on generated code? What (some objdumps or something)?
Or more descriptive log, why is this about to be done, please.

> 
> Signed-off-by: Joe Perches <[EMAIL PROTECTED]>
> 
> ---
> 
>  include/linux/sched.h |   24 
>  1 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index ba78807..71d40a1 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1222,22 +1222,22 @@ static inline int rt_prio(int prio)
>   return 0;
>  }
>  
> -static inline int rt_task(struct task_struct *p)
> +static inline int rt_task(const struct task_struct *p)
>  {
>   return rt_prio(p->prio);
>  }
>  
> -static inline pid_t process_group(struct task_struct *tsk)
> +static inline pid_t process_group(const struct task_struct *tsk)
>  {
>   return tsk->signal->pgrp;
>  }
>  
> -static inline pid_t signal_session(struct signal_struct *sig)
> +static inline pid_t signal_session(const struct signal_struct *sig)
>  {
>   return sig->__session;
>  }
>  
> -static inline pid_t process_session(struct task_struct *tsk)
> +static inline pid_t process_session(const struct task_struct *tsk)
>  {
>   return signal_session(tsk->signal);
>  }
> @@ -1247,22 +1247,22 @@ static inline void set_signal_session(struct 
> signal_struct *sig, pid_t session)
>   sig->__session = session;
>  }
>  
> -static inline struct pid *task_pid(struct task_struct *task)
> +static inline struct pid *task_pid(const struct task_struct *task)
>  {
>   return task->pids[PIDTYPE_PID].pid;
>  }
>  
> -static inline struct pid *task_tgid(struct task_struct *task)
> +static inline struct pid *task_tgid(const struct task_struct *task)
>  {
>   return task->group_leader->pids[PIDTYPE_PID].pid;
>  }
>  
> -static inline struct pid *task_pgrp(struct task_struct *task)
> +static inline struct pid *task_pgrp(const struct task_struct *task)
>  {
>   return task->group_leader->pids[PIDTYPE_PGID].pid;
>  }
>  
> -static inline struct pid *task_session(struct task_struct *task)
> +static inline struct pid *task_session(const struct task_struct *task)
>  {
>   return task->group_leader->pids[PIDTYPE_SID].pid;
>  }
> @@ -1275,7 +1275,7 @@ static inline struct pid *task_session(struct 
> task_struct *task)
>   * If pid_alive fails, then pointers within the task structure
>   * can be stale and must not be dereferenced.
>   */
> -static inline int pid_alive(struct task_struct *p)
> +static inline int pid_alive(const struct task_struct *p)
>  {
>   return p->pids[PIDTYPE_PID].pid != NULL;
>  }
> @@ -1286,7 +1286,7 @@ static inline int pid_alive(struct task_struct *p)
>   *
>   * Check if a task structure is the first user space task the kernel created.
>   */
> -static inline int is_init(struct task_struct *tsk)
> +static inline int is_init(const struct task_struct *tsk)
>  {
>   return tsk->pid == 1;
>  }
> @@ -1639,7 +1639,7 @@ extern void wait_task_inactive(struct task_struct * p);
>   * all we care about is that we have a task with the appropriate
>   * pid, we don't actually care if we have the right task.
>   */
> -static inline int has_group_leader_pid(struct task_struct *p)
> +static inline int has_group_leader_pid(const struct task_struct *p)
>  {
>   return p->pid == p->tgid;
>  }
> @@ -1650,7 +1650,7 @@ static inline struct task_struct *next_thread(const 
> struct task_struct *p)
> struct task_struct, thread_group);
>  }
>  
> -static inline int thread_group_empty(struct task_struct *p)
> +static inline int thread_group_empty(const struct task_struct *p)
>  {
>   return list_empty(&p->thread_group);
>  }
> 
> 



-- 
Jiri Slaby ([EMAIL PROTECTED])
Faculty of Informatics, Masaryk University
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: RFC: issues concerning the next NAPI interface

2007-08-27 Thread David Miller
From: James Chapman <[EMAIL PROTECTED]>
Date: Mon, 27 Aug 2007 16:51:29 +0100

> To implement this, there's no need for timers, hrtimers or generic NAPI 
> support that others have suggested. A driver's poll() would set an 
> internal flag and record the current jiffies value when finding 
> workdone=0 rather than doing an immediate napi_complete(). Early in 
> poll() it would test this flag and if set, do a low-cost test to see if 
> it had any work to do. If no work, it would check the saved jiffies 
> value and do the napi_complete() only if no work has been done for a 
> configurable number of jiffies. This keeps interrupts disabled longer at 
> the expense of many more calls to poll() where no work is done. So 
> critical to this scheme is modifying the driver's poll() to fastpath the 
> case of having no work to do while waiting for its local jiffy count to 
> expire.
> 
> Here's an untested patch for tg3 that illustrates the idea.

It's only going to work with hrtimers, these interfaces can
process at least 100,000 per jiffies tick.

And the hrtimer granularity is going to need to be significantly low,
and futhermore you're adding a guaranteed extra interrupt (for the
hrtimer firing) in these cases where we're exactly trying to avoid is
more interrupts.

If you can make it work, fine, but it's going to need to be at a
minimum disabled when the hrtimer granularity is not sufficient.

But there are huger fish to fry for you I think.  Talk to your
platform maintainers and ask for an interface for obtaining
a flat static distribution of interrupts to cpus in order to
support multiqueue NAPI better.

In your previous postings you made arguments saying that the
automatic placement of interrupts to cpus made everything
bunch of to a single cpu and you wanted to propagate the
NAPI work to other cpu's software interrupts from there.

That logic is bogus, because it merely proves that the hardware
interrupt distribution is broken.  If it's a bad cpu to run
software interrupts on, it's also a bad cpu to run hardware
interrupts on.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] SLUB use cmpxchg_local

2007-08-27 Thread Christoph Lameter
I think the simplest solution may be to leave slub as done in the patch 
that we developed last week. The arch must provide a cmpxchg_local that is 
performance wise the fastest possible. On x86 this is going to be the 
cmpxchg_local on others where cmpxchg is slower than interrupt 
disable/enable this is going to be the emulation that does

interrupt disable

cmpchg simulation

interrupt enable


If we can establish that this is not a performance regression then we have 
a clean solution source code wise. It also minimizes the interrupt holdoff 
for the non-cmpxchg_local arches. However, it means that we will have to 
disable interrupts twice for the slow path. If that is too expensive then 
we need a different solution.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [parisc-linux] [patch 15/23] Add cmpxchg_local to parisc

2007-08-27 Thread Grant Grundler
On Sun, Aug 12, 2007 at 10:54:49AM -0400, Mathieu Desnoyers wrote:
> Use the new generic cmpxchg_local (disables interrupt). Also use the generic
> cmpxchg as fallback if SMP is not set.

Mathieu,
thanks for adding __cmpxchg_local to parisc but why do we need it?

By definition, atomic operators are, well, atomic.

I searched for __cmpxchg_local and found this reference:
http://www.ussg.iu.edu/hypermail/linux/kernel/0612.2/1337.html

but the "root" of that thread (Dec 20, 2006):
http://www.ussg.iu.edu/hypermail/linux/kernel/0612.2/1334.html

Doesn't explain the difference between "local" and "non-local" either.
Per CPU data should only need memory barriers (in some cases) and
protection against interrupts (in probably more cases). So I'm not
understanding why a new set of APIs is needed.

Can you add a description to Documentation/atomic_ops.txt ?
*sigh* sorry for being "late to the party" on this one...

cheers,
grant

> 
> Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]>
> CC: [EMAIL PROTECTED]
> CC: [EMAIL PROTECTED]
> ---
>  include/asm-parisc/atomic.h |   29 +
>  1 file changed, 29 insertions(+)
> 
> Index: linux-2.6-lttng/include/asm-parisc/atomic.h
> ===
> --- linux-2.6-lttng.orig/include/asm-parisc/atomic.h  2007-07-20 
> 19:44:40.0 -0400
> +++ linux-2.6-lttng/include/asm-parisc/atomic.h   2007-07-20 
> 19:44:47.0 -0400
> @@ -122,6 +122,35 @@ __cmpxchg(volatile void *ptr, unsigned l
>   (unsigned long)_n_, sizeof(*(ptr))); \
>})
>  
> +#include 
> +
> +static inline unsigned long __cmpxchg_local(volatile void *ptr,
> +   unsigned long old,
> +   unsigned long new_, int size)
> +{
> + switch (size) {
> +#ifdef CONFIG_64BIT
> + case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_);
> +#endif
> + case 4: return __cmpxchg_u32(ptr, old, new_);
> + default:
> + return __cmpxchg_local_generic(ptr, old, new_, size);
> + }
> +}
> +
> +/*
> + * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
> + * them available.
> + */
> +#define cmpxchg_local(ptr,o,n)   
> \
> + (__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o),  \
> +  (unsigned long)(n), sizeof(*(ptr)))
> +#ifdef CONFIG_64BIT
> +#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr), (o), (n))
> +#else
> +#define cmpxchg64_local(ptr,o,n) __cmpxchg64_local_generic((ptr), (o), (n))
> +#endif
> +
>  /* Note that we need not lock read accesses - aligned word writes/reads
>   * are atomic, so a reader never sees unconsistent values.
>   *
> 
> -- 
> Mathieu Desnoyers
> Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
> OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
> ___
> parisc-linux mailing list
> [EMAIL PROTECTED]
> http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] fix bogus hotplug cpu warning

2007-08-27 Thread Hugh Dickins
On Mon, 27 Aug 2007, Andrew Morton wrote:
> On Mon, 27 Aug 2007 21:37:14 +0100 (BST)
> Hugh Dickins <[EMAIL PROTECTED]> wrote:
> 
> > > So I agree with the patch, but not with its description.
> > 
> > I don't see which part of the description you disagree with, but please
> > do improve it if you can.
> 
> I'd change the description to
> 
> 
> current_is_keventd() is a stupid load of crap.  It does
> 
> int current_is_keventd(void)
> {
>   struct cpu_workqueue_struct *cwq;
>   int cpu = smp_processor_id();   /* preempt-safe: keventd is per-cpu */
> 
> but that comment (and the code itself) only make sense when
> current_is_keventd() is called by keventd.  In which case thers is no point
> in the function even existing!

I disagree.  The comment (your very own, I think?) and the code made
sense to me.  It's saying this is rather unusual, but safe against
preemption, because keventd is per-cpu (it might perhaps be better
if it said each keventd is bound to a cpu).

The code works in such a way that if it is a keventd, then it'll
correctly arrive at the answer yes; and if it's not a keventd,
then even if it's preempted to a different cpu in the middle,
the test won't match any keventd and so it'll correctly arrive
at the answer no.

But I'm content with the half-liner already there.

> 
> We need to use raw_smp_processor_id() so that non-keventd (or, more
> specifically, non-pinned-to-one-cpu) callers won't generate "using
> smp_processor_id() in preemptible" warnings.

Yes, that's true, raw_smp_processor_id() is needed to avoid the
warning; but it was already preempt-safe with smp_processor_id(),
just in danger of giving an inappropriate warning.

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [parisc-linux] [patch 15/23] Add cmpxchg_local to parisc

2007-08-27 Thread Mathieu Desnoyers
* Grant Grundler ([EMAIL PROTECTED]) wrote:
> On Sun, Aug 12, 2007 at 10:54:49AM -0400, Mathieu Desnoyers wrote:
> > Use the new generic cmpxchg_local (disables interrupt). Also use the generic
> > cmpxchg as fallback if SMP is not set.
> 
> Mathieu,
> thanks for adding __cmpxchg_local to parisc but why do we need it?
> 
> By definition, atomic operators are, well, atomic.
> 
> I searched for __cmpxchg_local and found this reference:
> http://www.ussg.iu.edu/hypermail/linux/kernel/0612.2/1337.html
> 
> but the "root" of that thread (Dec 20, 2006):
> http://www.ussg.iu.edu/hypermail/linux/kernel/0612.2/1334.html
> 
> Doesn't explain the difference between "local" and "non-local" either.
> Per CPU data should only need memory barriers (in some cases) and
> protection against interrupts (in probably more cases). So I'm not
> understanding why a new set of APIs is needed.
> 
> Can you add a description to Documentation/atomic_ops.txt ?
> *sigh* sorry for being "late to the party" on this one...
> 

Does Documentation/local_ops.txt answer your questions ? If not, please
tell me and I'll gladly explain more.

Mathieu

> cheers,
> grant
> 
> > 
> > Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]>
> > CC: [EMAIL PROTECTED]
> > CC: [EMAIL PROTECTED]
> > ---
> >  include/asm-parisc/atomic.h |   29 +
> >  1 file changed, 29 insertions(+)
> > 
> > Index: linux-2.6-lttng/include/asm-parisc/atomic.h
> > ===
> > --- linux-2.6-lttng.orig/include/asm-parisc/atomic.h2007-07-20 
> > 19:44:40.0 -0400
> > +++ linux-2.6-lttng/include/asm-parisc/atomic.h 2007-07-20 
> > 19:44:47.0 -0400
> > @@ -122,6 +122,35 @@ __cmpxchg(volatile void *ptr, unsigned l
> > (unsigned long)_n_, sizeof(*(ptr))); \
> >})
> >  
> > +#include 
> > +
> > +static inline unsigned long __cmpxchg_local(volatile void *ptr,
> > + unsigned long old,
> > + unsigned long new_, int size)
> > +{
> > +   switch (size) {
> > +#ifdef CONFIG_64BIT
> > +   case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_);
> > +#endif
> > +   case 4: return __cmpxchg_u32(ptr, old, new_);
> > +   default:
> > +   return __cmpxchg_local_generic(ptr, old, new_, size);
> > +   }
> > +}
> > +
> > +/*
> > + * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always 
> > make
> > + * them available.
> > + */
> > +#define cmpxchg_local(ptr,o,n) 
> > \
> > + (__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o),
> > \
> > +(unsigned long)(n), sizeof(*(ptr)))
> > +#ifdef CONFIG_64BIT
> > +#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr), (o), (n))
> > +#else
> > +#define cmpxchg64_local(ptr,o,n) __cmpxchg64_local_generic((ptr), (o), (n))
> > +#endif
> > +
> >  /* Note that we need not lock read accesses - aligned word writes/reads
> >   * are atomic, so a reader never sees unconsistent values.
> >   *
> > 
> > -- 
> > Mathieu Desnoyers
> > Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
> > OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
> > ___
> > parisc-linux mailing list
> > [EMAIL PROTECTED]
> > http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/23] drm: introduce drm_zalloc

2007-08-27 Thread m . kozlowski
Hello,

As there are many places in drm code where drm_alloc + memset is used
this patch series introduces drm_zalloc and also makes use of drm_calloc where
needed. Most of these patches save some bytes so the benefit is a few kB saved
(gcc 4.1.2) with patch applied. Also some small (style, etc.) things are fixed.
This patch series does the conversion drm tree-wide. All patches were compile
tested.

Patches are against 2.6.23-rc3-mm1. Please review and apply.

Regards,

Mariusz

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/23] introduce drm_zalloc as a drm_alloc + memset replacement

2007-08-27 Thread m . kozlowski
Add drm_zalloc().

Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drmP.h |7 +++
 drivers/char/drm/drm_memory_debug.h |   17 ++---
 2 files changed, 21 insertions(+), 3 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drmP.h
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drmP.h
@@ -1125,10 +1125,17 @@ static __inline__ void *drm_calloc(size_
 {
return kcalloc(nmemb, size, GFP_KERNEL);
 }
+
+/** Wrapper around kzalloc() */
+static __inline__ void *drm_zalloc(size_t size, int area)
+{
+   return kzalloc(size, GFP_KERNEL);
+}
 #else
 extern void *drm_alloc(size_t size, int area);
 extern void drm_free(void *pt, size_t size, int area);
 extern void *drm_calloc(size_t nmemb, size_t size, int area);
+extern void *drm_zalloc(size_t size, int area);
 #endif
 
 /[EMAIL PROTECTED]/
--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_memory_debug.h
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_memory_debug.h
@@ -167,13 +167,24 @@ void *drm_alloc (size_t size, int area) 
 void *drm_calloc (size_t nmemb, size_t size, int area) {
void *addr;
 
-   addr = drm_alloc (nmemb * size, area);
-   if (addr != NULL)
-   memset((void *)addr, 0, size * nmemb);
+   addr = drm_alloc(nmemb * size, area);
+   if (!addr)
+   memset(addr, 0, size * nmemb);
 
return addr;
 }
 
+void *drm_zalloc(size_t size, int area)
+{
+   void *addr;
+
+   addr = drm_alloc(size, area);
+   if (!addr)
+   memset(addr, 0, size);
+   
+   return addr;
+}
+
 void *drm_realloc (void *oldpt, size_t oldsize, size_t size, int area) {
void *pt;
 

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/23] drm_agpsupport.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_agpsupport.c | 13896 -> 13828 (-68 bytes)
 drivers/char/drm/drm_agpsupport.o | 120046 -> 119814 (-232 bytes)

 drivers/char/drm/drm_agpsupport.c |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_agpsupport.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_agpsupport.c
@@ -216,10 +216,10 @@ int drm_agp_alloc(struct drm_device *dev

if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
-   if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS)))
-   return -ENOMEM;

-   memset(entry, 0, sizeof(*entry));
+   entry = drm_zalloc(sizeof(*entry), DRM_MEM_AGPLISTS);
+   if (!entry)
+   return -ENOMEM;

pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
type = (u32) request->type;
@@ -444,11 +444,12 @@ int drm_agp_free_ioctl(struct inode *ino
  */
 struct drm_agp_head *drm_agp_init(struct drm_device *dev)
 {
-   struct drm_agp_head *head = NULL;
+   struct drm_agp_head *head;

-   if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
+   head = drm_zalloc(sizeof(*head), DRM_MEM_AGPLISTS);
+   if (!head)
return NULL;
-   memset((void *)head, 0, sizeof(*head));
+
head->bridge = agp_find_bridge(dev->pdev);
if (!head->bridge) {
if (!(head->bridge = agp_backend_acquire(dev->pdev))) {

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/23] drm_auth.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_auth.c | 5835 -> 5802 (-33 bytes)
 drivers/char/drm/drm_auth.o | 104968 -> 104860 (-108 bytes)

 drivers/char/drm/drm_auth.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_auth.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_auth.c
@@ -78,12 +78,11 @@ static int drm_add_magic(struct drm_devi

DRM_DEBUG("%d\n", magic);

-   entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC);
+   entry = drm_zalloc(sizeof(*entry), DRM_MEM_MAGIC);
if (!entry)
return -ENOMEM;
-   memset(entry, 0, sizeof(*entry));
-   entry->priv = priv;

+   entry->priv = priv;
entry->hash_item.key = (unsigned long)magic;
mutex_lock(&dev->struct_mutex);
drm_ht_insert_item(&dev->magiclist, &entry->hash_item);

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/23] drm_bufs.c: drm_alloc + memset to drm_alloc

2007-08-27 Thread m . kozlowski
This patch does dma_alloc and memset conversion to drm_zalloc or drm_calloc.

Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_bufs.c | 44959 -> 44420 (-539 bytes)
 drivers/char/drm/drm_bufs.o | 149686 -> 146822 (-2864 bytes)

 drivers/char/drm/drm_bufs.c |   31 ++-
 1 file changed, 10 insertions(+), 21 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_bufs.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_bufs.c
@@ -277,14 +277,13 @@ static int drm_addmap_core(struct drm_de
return -EINVAL;
}

-   list = drm_alloc(sizeof(*list), DRM_MEM_MAPS);
+   list = drm_zalloc(sizeof(*list), DRM_MEM_MAPS);
if (!list) {
if (map->type == _DRM_REGISTERS)
iounmap(map->handle);
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return -EINVAL;
}
-   memset(list, 0, sizeof(*list));
list->map = map;

mutex_lock(&dev->struct_mutex);
@@ -627,14 +626,13 @@ int drm_addbufs_agp(struct drm_device *
return -EINVAL;
}

-   entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+   entry->buflist = drm_calloc(count, sizeof(*entry->buflist),
   DRM_MEM_BUFS);
if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
}
-   memset(entry->buflist, 0, count * sizeof(*entry->buflist));

entry->buf_size = size;
entry->page_order = page_order;
@@ -658,7 +656,7 @@ int drm_addbufs_agp(struct drm_device *
buf->filp = NULL;

buf->dev_priv_size = dev->driver->dev_priv_size;
-   buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
+   buf->dev_private = drm_zalloc(buf->dev_priv_size, DRM_MEM_BUFS);
if (!buf->dev_private) {
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
@@ -667,7 +665,6 @@ int drm_addbufs_agp(struct drm_device *
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
}
-   memset(buf->dev_private, 0, buf->dev_priv_size);

DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);

@@ -783,16 +780,15 @@ int drm_addbufs_pci(struct drm_device *
return -EINVAL;
}

-   entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+   entry->buflist = drm_calloc(count, sizeof(*entry->buflist),
   DRM_MEM_BUFS);
if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
}
-   memset(entry->buflist, 0, count * sizeof(*entry->buflist));

-   entry->seglist = drm_alloc(count * sizeof(*entry->seglist),
+   entry->seglist = drm_calloc(count, sizeof(*entry->seglist),
   DRM_MEM_SEGS);
if (!entry->seglist) {
drm_free(entry->buflist,
@@ -801,7 +797,6 @@ int drm_addbufs_pci(struct drm_device *
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
}
-   memset(entry->seglist, 0, count * sizeof(*entry->seglist));

/* Keep the original pagelist until we know all the allocations
 * have succeeded
@@ -869,7 +864,7 @@ int drm_addbufs_pci(struct drm_device *
buf->filp = NULL;

buf->dev_priv_size = dev->driver->dev_priv_size;
-   buf->dev_private = drm_alloc(buf->dev_priv_size,
+   buf->dev_private = drm_zalloc(buf->dev_priv_size,
 DRM_MEM_BUFS);
if (!buf->dev_private) {
/* Set count correctly so we free the proper 
amount. */
@@ -885,7 +880,6 @@ int drm_addbufs_pci(struct drm_device *
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
}
-   memset(buf->dev_private, 0, buf->dev_priv_size);

DRM_DEBUG("buffer %d @ %p\n",
  entry->buf_count, buf->address);
@@ -1015,14 +1009,13 @@ static int drm_addbufs_sg(struct drm_dev
return -EINVAL;
}

-   entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+   entry->buflist = drm_calloc(count, sizeof(*entry->buflist),
   DRM_MEM_BUFS);
if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
}
-   memset(entry->buflist, 0, count * sizeof(*entry->buflist));

entry->

[PATCH 05/23] drm_dma.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
This patch does the conversion of drm_alloc + memset to drm_zalloc.
The memset in loop is also superfluous and can be removed.

Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_dma.c | 4624 -> 4475 (-149 bytes)
 drivers/char/drm/drm_dma.o | 104277 -> 103917 (-360 bytes)

 drivers/char/drm/drm_dma.c |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_dma.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_dma.c
@@ -45,17 +45,10 @@
  */
 int drm_dma_setup(struct drm_device *dev)
 {
-   int i;
-
-   dev->dma = drm_alloc(sizeof(*dev->dma), DRM_MEM_DRIVER);
+   dev->dma = drm_zalloc(sizeof(*dev->dma), DRM_MEM_DRIVER);
if (!dev->dma)
return -ENOMEM;

-   memset(dev->dma, 0, sizeof(*dev->dma));
-
-   for (i = 0; i <= DRM_MAX_ORDER; i++)
-   memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0]));
-
return 0;
 }

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/23] drm_drawable.c: drm_calloc to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_drawable.c | 5425 -> 5422 (-3 bytes)
 drivers/char/drm/drm_drawable.o | 108201 -> 107765 (-436 bytes)

 drivers/char/drm/drm_drawable.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_drawable.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_drawable.c
@@ -110,7 +110,7 @@ int drm_update_drawable_info(DRM_IOCTL_A

info = idr_find(&dev->drw_idr, update.handle);
if (!info) {
-   info = drm_calloc(1, sizeof(*info), DRM_MEM_BUFS);
+   info = drm_zalloc(sizeof(*info), DRM_MEM_BUFS);
if (!info)
return -ENOMEM;
if (IS_ERR(idr_replace(&dev->drw_idr, info, update.handle))) {

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/23] drm_fops.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_fops.c | 11849 -> 11817 (-32 bytes)
 drivers/char/drm/drm_fops.o | 115963 -> 115177 (-786 bytes)

 drivers/char/drm/drm_fops.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_fops.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_fops.c
@@ -236,11 +236,10 @@ static int drm_open_helper(struct inode

DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor);

-   priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES);
+   priv = drm_zalloc(sizeof(*priv), DRM_MEM_FILES);
if (!priv)
return -ENOMEM;

-   memset(priv, 0, sizeof(*priv));
filp->private_data = priv;
priv->uid = current->euid;
priv->pid = current->pid;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/23] drm_irq.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_irq.c | 13062 -> 13003 (-59 bytes)
 drivers/char/drm/drm_irq.o | 114446 -> 114298 (-148 bytes)

 drivers/char/drm/drm_irq.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_irq.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_irq.c
@@ -322,13 +322,9 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)

spin_unlock_irqrestore(&dev->vbl_lock, irqflags);

-   if (!
-   (vbl_sig =
-drm_alloc(sizeof(struct drm_vbl_sig), DRM_MEM_DRIVER))) {
+   vbl_sig = drm_zalloc(sizeof(struct drm_vbl_sig), 
DRM_MEM_DRIVER);
+   if (!vbl_sig)
return -ENOMEM;
-   }
-
-   memset((void *)vbl_sig, 0, sizeof(*vbl_sig));

vbl_sig->sequence = vblwait.request.sequence;
vbl_sig->info.si_signo = vblwait.request.signal;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/23] drm_scatter.c: drm_alloc + memset to drm_alloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_scatter.c | 6113 -> 5945 (-168 bytes)
 drivers/char/drm/drm_scatter.o | 105552 -> 105584 (+32 bytes)

 drivers/char/drm/drm_scatter.c |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_scatter.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_scatter.c
@@ -83,26 +83,22 @@ int drm_sg_alloc(struct inode *inode, st
if (copy_from_user(&request, argp, sizeof(request)))
return -EFAULT;

-   entry = drm_alloc(sizeof(*entry), DRM_MEM_SGLISTS);
+   entry = drm_zalloc(sizeof(*entry), DRM_MEM_SGLISTS);
if (!entry)
return -ENOMEM;

-   memset(entry, 0, sizeof(*entry));
-
pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
DRM_DEBUG("sg size=%ld pages=%ld\n", request.size, pages);

entry->pages = pages;
-   entry->pagelist = drm_alloc(pages * sizeof(*entry->pagelist),
+   entry->pagelist = drm_calloc(pages, sizeof(*entry->pagelist),
DRM_MEM_PAGES);
if (!entry->pagelist) {
drm_free(entry, sizeof(*entry), DRM_MEM_SGLISTS);
return -ENOMEM;
}

-   memset(entry->pagelist, 0, pages * sizeof(*entry->pagelist));
-
-   entry->busaddr = drm_alloc(pages * sizeof(*entry->busaddr),
+   entry->busaddr = drm_calloc(pages, sizeof(*entry->busaddr),
   DRM_MEM_PAGES);
if (!entry->busaddr) {
drm_free(entry->pagelist,
@@ -111,7 +107,6 @@ int drm_sg_alloc(struct inode *inode, st
drm_free(entry, sizeof(*entry), DRM_MEM_SGLISTS);
return -ENOMEM;
}
-   memset((void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr));

entry->virtual = vmalloc_32(pages << PAGE_SHIFT);
if (!entry->virtual) {

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/23] drm_sman.c: drm_calloc to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_sman.c | 9108 -> 9094 (-14 bytes)
 drivers/char/drm/drm_sman.o | 104466 -> 103946 (-520 bytes)

 drivers/char/drm/drm_sman.c |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_sman.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_sman.c
@@ -130,10 +130,10 @@ drm_sman_set_range(struct drm_sman * sma
BUG_ON(manager >= sman->num_managers);

sman_mm = &sman->mm[manager];
-   mm = drm_calloc(1, sizeof(*mm), DRM_MEM_MM);
-   if (!mm) {
+   mm = drm_zalloc(sizeof(*mm), DRM_MEM_MM);
+   if (!mm)
return -ENOMEM;
-   }
+
sman_mm->private = mm;
ret = drm_mm_init(mm, start, size);

@@ -176,7 +176,7 @@ static struct drm_owner_item *drm_sman_g
  owner_hash);
}

-   owner_item = drm_calloc(1, sizeof(*owner_item), DRM_MEM_MM);
+   owner_item = drm_zalloc(sizeof(*owner_item), DRM_MEM_MM);
if (!owner_item)
goto out;

@@ -212,8 +212,7 @@ struct drm_memblock_item *drm_sman_alloc
return NULL;
}

-   memblock = drm_calloc(1, sizeof(*memblock), DRM_MEM_MM);
-
+   memblock = drm_zalloc(sizeof(*memblock), DRM_MEM_MM);
if (!memblock)
goto out;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/23] drm_stub.c: drm_calloc to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/drm_stub.c | 7731 -> 7728 (-3 bytes)
 drivers/char/drm/drm_stub.o | 110301 -> 111354 (+1053 bytes)

 drivers/char/drm/drm_stub.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/drm_stub.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/drm_stub.c
@@ -210,7 +210,7 @@ int drm_get_dev(struct pci_dev *pdev, co

DRM_DEBUG("\n");

-   dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB);
+   dev = drm_zalloc(sizeof(*dev), DRM_MEM_STUB);
if (!dev)
return -ENOMEM;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/23] i810_dma.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/i810_dma.c | 37542 -> 37480 (-62 bytes)
 drivers/char/drm/i810_dma.o | 150664 -> 149996 (-668 bytes)

 drivers/char/drm/i810_dma.c |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/i810_dma.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/i810_dma.c
@@ -328,7 +328,6 @@ static int i810_dma_initialize(struct dr
   drm_i810_init_t * init)
 {
struct drm_map_list *r_list;
-   memset(dev_priv, 0, sizeof(drm_i810_private_t));

list_for_each_entry(r_list, &dev->maplist, head) {
if (r_list->map &&
@@ -498,9 +497,9 @@ static int i810_dma_init(struct inode *i
if (retcode)
return retcode;

-   dev_priv = drm_alloc(sizeof(drm_i810_private_t),
+   dev_priv = drm_zalloc(sizeof(drm_i810_private_t),
 DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   if (!dev_priv)
return -ENOMEM;
retcode = i810_dma_initialize(dev, dev_priv, &init);
break;
@@ -512,9 +511,9 @@ static int i810_dma_init(struct inode *i
   sizeof(drm_i810_init_t))) {
return -EFAULT;
}
-   dev_priv = drm_alloc(sizeof(drm_i810_private_t),
+   dev_priv = drm_zalloc(sizeof(drm_i810_private_t),
 DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   if (!dev_priv)
return -ENOMEM;
retcode = i810_dma_initialize(dev, dev_priv, &init);
break;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/23] i830_dma.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/i830_dma.c | 41269 -> 41212 (-57 bytes)
 drivers/char/drm/i830_dma.o | 157920 -> 157480 (-440 bytes)

 drivers/char/drm/i830_dma.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/i830_dma.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/i830_dma.c
@@ -336,8 +336,6 @@ static int i830_dma_initialize(struct dr
 {
struct drm_map_list *r_list;

-   memset(dev_priv, 0, sizeof(drm_i830_private_t));
-
list_for_each_entry(r_list, &dev->maplist, head) {
if (r_list->map &&
r_list->map->type == _DRM_SHM &&
@@ -465,9 +463,9 @@ static int i830_dma_init(struct inode *i

switch (init.func) {
case I830_INIT_DMA:
-   dev_priv = drm_alloc(sizeof(drm_i830_private_t),
+   dev_priv = drm_zalloc(sizeof(drm_i830_private_t),
 DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   if (!dev_priv)
return -ENOMEM;
retcode = i830_dma_initialize(dev, dev_priv, &init);
break;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/23] i915_dma.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/i915_dma.c | 22680 -> 22623 (-57 bytes)
 drivers/char/drm/i915_dma.o | 134192 -> 133704 (-488 bytes)

 drivers/char/drm/i915_dma.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/i915_dma.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/i915_dma.c
@@ -130,8 +130,6 @@ static int i915_initialize(struct drm_de
   drm_i915_private_t * dev_priv,
   drm_i915_init_t * init)
 {
-   memset(dev_priv, 0, sizeof(drm_i915_private_t));
-
dev_priv->sarea = drm_getsarea(dev);
if (!dev_priv->sarea) {
DRM_ERROR("can not find sarea!\n");
@@ -263,9 +261,9 @@ static int i915_dma_init(DRM_IOCTL_ARGS)

switch (init.func) {
case I915_INIT_DMA:
-   dev_priv = drm_alloc(sizeof(drm_i915_private_t),
+   dev_priv = drm_zalloc(sizeof(drm_i915_private_t),
 DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   if (!dev_priv)
return DRM_ERR(ENOMEM);
retcode = i915_initialize(dev, dev_priv, &init);
break;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 17/23] mga_dma.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/mga_dma.c | 30418 -> 30253 (-165 bytes)
 drivers/char/drm/mga_dma.o | 140668 -> 140304 (-364 bytes)

 drivers/char/drm/mga_dma.c |   14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/mga_dma.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/mga_dma.c
@@ -254,23 +254,20 @@ static int mga_freelist_init(struct drm_
int i;
DRM_DEBUG("count=%d\n", dma->buf_count);

-   dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER);
-   if (dev_priv->head == NULL)
+   dev_priv->head = drm_zalloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER);
+   if (!dev_priv->head)
return DRM_ERR(ENOMEM);

-   memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t));
SET_AGE(&dev_priv->head->age, MGA_BUFFER_USED, 0);

for (i = 0; i < dma->buf_count; i++) {
buf = dma->buflist[i];
buf_priv = buf->dev_private;

-   entry = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER);
-   if (entry == NULL)
+   entry = drm_zalloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER);
+   if (!entry)
return DRM_ERR(ENOMEM);

-   memset(entry, 0, sizeof(drm_mga_freelist_t));
-
entry->next = dev_priv->head->next;
entry->prev = dev_priv->head;
SET_AGE(&entry->age, MGA_BUFFER_FREE, 0);
@@ -397,12 +394,11 @@ int mga_driver_load(struct drm_device *
 {
drm_mga_private_t *dev_priv;

-   dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER);
+   dev_priv = drm_zalloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER);
if (!dev_priv)
return DRM_ERR(ENOMEM);

dev->dev_private = (void *)dev_priv;
-   memset(dev_priv, 0, sizeof(drm_mga_private_t));

dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT;
dev_priv->chipset = flags;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/23] i915_irq.c: drm_calloc to drm_zalloc and bugfix

2007-08-27 Thread m . kozlowski
This patch does drm_calloc to drm_zalloc conversion. Also it
seems that unpatched version allocated wrong nr of bytes.

drm_i915_vbl_swap_t *vbl_swap;

...

sizeof(vbl_swap) vs. sizeof(*vbl_swap)

No?

Please review.

Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/i915_irq.c | 15749 -> 15746 (-3 bytes)
 drivers/char/drm/i915_irq.o | 128940 -> 128856 (-84 bytes)

 drivers/char/drm/i915_irq.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/i915_irq.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/i915_irq.c
@@ -541,8 +541,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
return DRM_ERR(EBUSY);
}

-   vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER);
-
+   vbl_swap = drm_zalloc(sizeof(*vbl_swap), DRM_MEM_DRIVER);
if (!vbl_swap) {
DRM_ERROR("Failed to allocate memory to queue swap\n");
return DRM_ERR(ENOMEM);

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 16/23] i915_mem.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/i915_mem.c | 9842 -> 9808 (-34 bytes)
 drivers/char/drm/i915_mem.o | 114556 -> 114464 (-92 bytes)

 drivers/char/drm/i915_mem.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/i915_mem.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/i915_mem.c
@@ -189,7 +189,7 @@ static int init_heap(struct mem_block **
if (!blocks)
return -ENOMEM;

-   *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFLISTS);
+   *heap = drm_zalloc(sizeof(**heap), DRM_MEM_BUFLISTS);
if (!*heap) {
drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFLISTS);
return -ENOMEM;
@@ -200,7 +200,6 @@ static int init_heap(struct mem_block **
blocks->filp = NULL;
blocks->next = blocks->prev = *heap;

-   memset(*heap, 0, sizeof(**heap));
(*heap)->filp = (DRMFILE) - 1;
(*heap)->next = (*heap)->prev = blocks;
return 0;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 19/23] radeon_cp.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/radeon_cp.c | 62519 -> 62461 (-58 bytes)
 drivers/char/drm/radeon_cp.o | 160564 -> 160596 (+32 bytes)

 drivers/char/drm/radeon_cp.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/radeon_cp.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/radeon_cp.c
@@ -2239,11 +2239,10 @@ int radeon_driver_load(struct drm_device
drm_radeon_private_t *dev_priv;
int ret = 0;

-   dev_priv = drm_alloc(sizeof(drm_radeon_private_t), DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   dev_priv = drm_zalloc(sizeof(drm_radeon_private_t), DRM_MEM_DRIVER);
+   if (!dev_priv)
return DRM_ERR(ENOMEM);

-   memset(dev_priv, 0, sizeof(drm_radeon_private_t));
dev->dev_private = (void *)dev_priv;
dev_priv->flags = flags;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 18/23] r128_cce.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/r128_cce.c | 25912 -> 25792 (-120 bytes)
 drivers/char/drm/r128_cce.o | 133640 -> 133468 (-172 bytes)

 drivers/char/drm/r128_cce.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/r128_cce.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/r128_cce.c
@@ -353,12 +353,10 @@ static int r128_do_init_cce(struct drm_d

DRM_DEBUG("\n");

-   dev_priv = drm_alloc(sizeof(drm_r128_private_t), DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   dev_priv = drm_zalloc(sizeof(drm_r128_private_t), DRM_MEM_DRIVER);
+   if (!dev_priv)
return DRM_ERR(ENOMEM);

-   memset(dev_priv, 0, sizeof(drm_r128_private_t));
-
dev_priv->is_pci = init->is_pci;

if (dev_priv->is_pci && !dev->sg) {
@@ -778,11 +776,10 @@ static int r128_freelist_init(struct drm
drm_r128_freelist_t *entry;
int i;

-   dev_priv->head = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER);
-   if (dev_priv->head == NULL)
+   dev_priv->head = drm_zalloc(sizeof(drm_r128_freelist_t), 
DRM_MEM_DRIVER);
+   if (!dev_priv->head)
return DRM_ERR(ENOMEM);

-   memset(dev_priv->head, 0, sizeof(drm_r128_freelist_t));
dev_priv->head->age = R128_BUFFER_USED;

for (i = 0; i < dma->buf_count; i++) {

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 21/23] savage_bci.c: drm_alloc + memset to drm_zalloc and cleanup

2007-08-27 Thread m . kozlowski
The initialization in for loop can be removed as the SET_AGE macro
set the age struct and other members to zero.

Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/savage_bci.c | 31888 -> 31634 (-254 bytes)
 drivers/char/drm/savage_bci.o | 138936 -> 138984 (+48 bytes)

 drivers/char/drm/savage_bci.c |   18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/savage_bci.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/savage_bci.c
@@ -294,20 +294,13 @@ void savage_freelist_put(struct drm_devi
  */
 static int savage_dma_init(drm_savage_private_t * dev_priv)
 {
-   unsigned int i;
-
dev_priv->nr_dma_pages = dev_priv->cmd_dma->size /
(SAVAGE_DMA_PAGE_SIZE * 4);
-   dev_priv->dma_pages = drm_alloc(sizeof(drm_savage_dma_page_t) *
-   dev_priv->nr_dma_pages, DRM_MEM_DRIVER);
-   if (dev_priv->dma_pages == NULL)
+   dev_priv->dma_pages = drm_calloc(dev_priv->nr_dma_pages,
+   sizeof(drm_savage_dma_page_t), DRM_MEM_DRIVER);
+   if (!dev_priv->dma_pages)
return DRM_ERR(ENOMEM);

-   for (i = 0; i < dev_priv->nr_dma_pages; ++i) {
-   SET_AGE(&dev_priv->dma_pages[i].age, 0, 0);
-   dev_priv->dma_pages[i].used = 0;
-   dev_priv->dma_pages[i].flushed = 0;
-   }
SET_AGE(&dev_priv->last_dma_age, 0, 0);

dev_priv->first_dma_page = 0;
@@ -539,11 +532,10 @@ int savage_driver_load(struct drm_device
 {
drm_savage_private_t *dev_priv;

-   dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   dev_priv = drm_zalloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER);
+   if (!dev_priv)
return DRM_ERR(ENOMEM);

-   memset(dev_priv, 0, sizeof(drm_savage_private_t));
dev->dev_private = (void *)dev_priv;

dev_priv->chipset = (enum savage_family)chipset;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 20/23] radeon_mem.c: drm_alloc + memset to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/radeon_mem.c | 7711 -> 7677 (-34 bytes)
 drivers/char/drm/radeon_mem.o | 115484 -> 115396 (-88 bytes)

 drivers/char/drm/radeon_mem.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/radeon_mem.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/radeon_mem.c
@@ -139,7 +139,7 @@ static int init_heap(struct mem_block **
if (!blocks)
return DRM_ERR(ENOMEM);

-   *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFS);
+   *heap = drm_zalloc(sizeof(**heap), DRM_MEM_BUFS);
if (!*heap) {
drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFS);
return DRM_ERR(ENOMEM);
@@ -150,7 +150,6 @@ static int init_heap(struct mem_block **
blocks->filp = NULL;
blocks->next = blocks->prev = *heap;

-   memset(*heap, 0, sizeof(**heap));
(*heap)->filp = (DRMFILE) - 1;
(*heap)->next = (*heap)->prev = blocks;
return 0;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 23/23] via_map.c: drm_calloc to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/via_map.c | 3449 -> 3439 (-10 bytes)
 drivers/char/drm/via_map.o | 110028 -> 110488 (+460 bytes)

 drivers/char/drm/via_map.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/via_map.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/via_map.c
@@ -100,8 +100,8 @@ int via_driver_load(struct drm_device *d
drm_via_private_t *dev_priv;
int ret = 0;

-   dev_priv = drm_calloc(1, sizeof(drm_via_private_t), DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   dev_priv = drm_zalloc(sizeof(drm_via_private_t), DRM_MEM_DRIVER);
+   if (!dev_priv)
return DRM_ERR(ENOMEM);

dev->dev_private = (void *)dev_priv;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 22/23] sis_drv.c: drm_calloc to drm_zalloc

2007-08-27 Thread m . kozlowski
Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>

 drivers/char/drm/sis_drv.c | 3249 -> 3239 (-10 bytes)
 drivers/char/drm/sis_drv.o | 104756 -> 105460 (+704 bytes)

 drivers/char/drm/sis_drv.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/sis_drv.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/sis_drv.c
@@ -40,8 +40,8 @@ static int sis_driver_load(struct drm_de
drm_sis_private_t *dev_priv;
int ret;

-   dev_priv = drm_calloc(1, sizeof(drm_sis_private_t), DRM_MEM_DRIVER);
-   if (dev_priv == NULL)
+   dev_priv = drm_zalloc(sizeof(drm_sis_private_t), DRM_MEM_DRIVER);
+   if (!dev_priv)
return DRM_ERR(ENOMEM);

dev->dev_private = (void *)dev_priv;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] v1 of IBM power meter driver

2007-08-27 Thread Darrick J. Wong
Hi everyone,

Attached is a driver to export sensor readings from power meters that
are found in several IBM x86 systems.  At the moment, the hwmon sysfs
documentation doesn't mention any naming conventions for sensors that
measure Watts, so I am proposing that they be called "powerX_input" in a
fashion similar to temperature/rpm/current sensors.  If that is
agreeable to everyone, I'll post a follow-up patch to amend the
documentation.

The patch should apply against 2.6.23-rc3 and has been tested on the
x3550, x3650, x3655, x3755 and HS20 blades that support it.  As far
as I know, those are the only systems in existence that have this
interface.
---
ibm_pex: Driver to export IBM PowerExecutive power meter sensors.

Signed-off-by: Darrick J. Wong <[EMAIL PROTECTED]>
---

 drivers/hwmon/Kconfig  |   12 +
 drivers/hwmon/Makefile |1 
 drivers/hwmon/ibmpex.c |  615 
 3 files changed, 628 insertions(+), 0 deletions(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 555f470..41ffa2e 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -275,6 +275,18 @@ config SENSORS_CORETEMP
  sensor inside your CPU. Supported all are all known variants
  of Intel Core family.
 
+config SENSORS_IBMPEX
+   tristate "IBM PowerExecutive temperature/power sensors"
+   depends on IPMI_SI
+   help
+ If you say yes here you get support for the temperature and
+ power sensors in various IBM System X servers that support
+ PowerExecutive.  So far this includes the x3550, x3650, x3655,
+ x3755, and certain HS20 blades.
+
+ This driver can also be built as a module.  If so, the module
+ will be called ibmpex.
+
 config SENSORS_IT87
tristate "ITE IT87xx and compatibles"
select HWMON_VID
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index a133981..31da6fe 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_SENSORS_FSCPOS)  += fscpos.o
 obj-$(CONFIG_SENSORS_GL518SM)  += gl518sm.o
 obj-$(CONFIG_SENSORS_GL520SM)  += gl520sm.o
 obj-$(CONFIG_SENSORS_HDAPS)+= hdaps.o
+obj-$(CONFIG_SENSORS_IBMPEX)   += ibmpex.o
 obj-$(CONFIG_SENSORS_IT87) += it87.o
 obj-$(CONFIG_SENSORS_K8TEMP)   += k8temp.o
 obj-$(CONFIG_SENSORS_LM63) += lm63.o
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c
new file mode 100644
index 000..15ae9ec
--- /dev/null
+++ b/drivers/hwmon/ibmpex.c
@@ -0,0 +1,615 @@
+/*
+ * A hwmon driver for the IBM PowerExecutive temperature/power sensors
+ * Copyright (C) 2007 IBM
+ *
+ * Author: Darrick J. Wong <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define REFRESH_INTERVAL   (5 * HZ)
+#define DRVNAME"ibmpex"
+
+static void ibmpex_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data);
+static void ibmpex_register_bmc(int iface, struct device *dev);
+static void ibmpex_bmc_gone(int iface);
+
+struct ibmpex_sensor_data {
+   int in_use;
+   s16 value;
+   s16 max;
+   s16 min;
+   int divisor;
+
+   struct sensor_device_attribute  attr_value;
+   struct sensor_device_attribute  attr_max;
+   struct sensor_device_attribute  attr_min;
+};
+
+struct ibmpex_bmc_data {
+   struct list_headlist;
+   struct class_device *class_dev;
+   struct device   *bmc_device;
+   struct mutexlock;
+   charvalid;
+   unsigned long   last_updated;   /* In jiffies */
+
+   struct ipmi_addraddress;
+   struct completion   read_complete;
+   ipmi_user_t user;
+   int interface;
+
+   struct kernel_ipmi_msg  tx_message;
+   unsigned char   tx_msg_data[IPMI_MAX_MSG_LENGTH];
+   longtx_msgid;
+
+   unsigned char   rx_msg_data[IPMI_MAX_MSG_LENGTH];
+   unsigned long   rx_msg_len;
+   unsigned char   rx_result;
+   int rx_recv_type;
+
+   unsigned char 

Re: [PATCH] SLUB use cmpxchg_local

2007-08-27 Thread Mathieu Desnoyers
* Christoph Lameter ([EMAIL PROTECTED]) wrote:
> I think the simplest solution may be to leave slub as done in the patch 
> that we developed last week. The arch must provide a cmpxchg_local that is 
> performance wise the fastest possible. On x86 this is going to be the 
> cmpxchg_local on others where cmpxchg is slower than interrupt 
> disable/enable this is going to be the emulation that does
> 
> interrupt disable
> 
> cmpchg simulation
> 
> interrupt enable
> 
> 
> If we can establish that this is not a performance regression then we have 
> a clean solution source code wise. It also minimizes the interrupt holdoff 
> for the non-cmpxchg_local arches. However, it means that we will have to 
> disable interrupts twice for the slow path. If that is too expensive then 
> we need a different solution.
> 

cmpxchg_local is not used on the slow path... ?

Did you meant:

it means that we will have to disable preemption _and_ interrupts on the
fast path for non-cmpxchg_local arches ?

Or maybe am I thinking about the wrong code snippet there ?

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [parisc-linux] [patch 15/23] Add cmpxchg_local to parisc

2007-08-27 Thread David Miller
From: Grant Grundler <[EMAIL PROTECTED]>
Date: Mon, 27 Aug 2007 15:04:32 -0600

> Doesn't explain the difference between "local" and "non-local" either.
> Per CPU data should only need memory barriers (in some cases) and
> protection against interrupts (in probably more cases). So I'm not
> understanding why a new set of APIs is needed.
> 
> Can you add a description to Documentation/atomic_ops.txt ?

My understanding is that the local versions can run without
memory barriers.  Only local cpu execution and local interrupt
threads of control can access the variable, and interrupts
force all stores to become visible to the local cpu so an
interrupt can't see the datum from before the atomic update
if one was in progress when the interrupt triggered, and
stuff like that.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] SLUB use cmpxchg_local

2007-08-27 Thread Christoph Lameter
On Mon, 27 Aug 2007, Mathieu Desnoyers wrote:

> > a clean solution source code wise. It also minimizes the interrupt holdoff 
> > for the non-cmpxchg_local arches. However, it means that we will have to 
> > disable interrupts twice for the slow path. If that is too expensive then 
> > we need a different solution.
> > 
> 
> cmpxchg_local is not used on the slow path... ?

Right.

> Did you meant:
> 
> it means that we will have to disable preemption _and_ interrupts on the
> fast path for non-cmpxchg_local arches ?

We would have to disable preemption and interrupts once on the fast path. 
The interrupt holdoff would just be a couple of instructions.

The slow path would require disable preemption and two interrupt disables.

Question is if this makes sense performance wise. If not then we may have 
to look at more complicated schemes.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] make "struct menu_governor" static (again)

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 02:06:48AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.23-rc2-mm2:
>...
>  git-acpi.patch
>...
>  git trees
>...

"struct menu_governor" needlessly again became global.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---
cb33b296204127cf50df54b84b2d79e152fb924b 
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index f5a8865..8d3fdc5 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -117,7 +117,7 @@ static int menu_enable_device(struct cpuidle_device *dev)
return 0;
 }
 
-struct cpuidle_governor menu_governor = {
+static struct cpuidle_governor menu_governor = {
.name = "menu",
.rating =   20,
.enable =   menu_enable_device,

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] remove parport_device_num()

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 02:06:48AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.23-rc2-mm2:
>...
> +sysctl-parport-remove-binary-paths.patch
>...
>  More sysctl work
>...

parport_device_num() is no longer used.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 Documentation/parport-lowlevel.txt |   29 +++--
 drivers/parport/daisy.c|   29 -
 include/linux/parport.h|1 -
 3 files changed, 3 insertions(+), 56 deletions(-)

0066510df2b5d4972cfd6a4450af8b82c763adfd 
diff --git a/Documentation/parport-lowlevel.txt 
b/Documentation/parport-lowlevel.txt
index 8f23024..265fcdc 100644
--- a/Documentation/parport-lowlevel.txt
+++ b/Documentation/parport-lowlevel.txt
@@ -25,7 +25,6 @@ Global functions:
   parport_open
   parport_close
   parport_device_id
-  parport_device_num
   parport_device_coords
   parport_find_class
   parport_find_device
@@ -735,7 +734,7 @@ NULL is returned.
 
 SEE ALSO
 
-parport_register_device, parport_device_num
+parport_register_device
 
 parport_close - unregister device for particular device number
 -
@@ -787,29 +786,7 @@ Many devices have ill-formed IEEE 1284 Device IDs.
 
 SEE ALSO
 
-parport_find_class, parport_find_device, parport_device_num
-
-parport_device_num - convert device coordinates to device number
---
-
-SYNOPSIS
-
-#include 
-
-int parport_device_num (int parport, int mux, int daisy);
-
-DESCRIPTION
-
-Convert between device coordinates (port, multiplexor, daisy chain
-address) and device number (zero-based).
-
-RETURN VALUE
-
-Device number, or -1 if no device at given coordinates.
-
-SEE ALSO
-
-parport_device_coords, parport_open, parport_device_id
+parport_find_class, parport_find_device
 
 parport_device_coords - convert device number to device coordinates
 --
@@ -833,7 +810,7 @@ Zero on success, in which case the coordinates are 
(*parport, *mux,
 
 SEE ALSO
 
-parport_device_num, parport_open, parport_device_id
+parport_open, parport_device_id
 
 parport_find_class - find a device by its class
 --
diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c
index ff9f344..5bbff20 100644
--- a/drivers/parport/daisy.c
+++ b/drivers/parport/daisy.c
@@ -275,35 +275,6 @@ void parport_close(struct pardevice *dev)
parport_unregister_device(dev);
 }
 
-/**
- * parport_device_num - convert device coordinates
- * @parport: parallel port number
- * @mux: multiplexor port number (-1 for no multiplexor)
- * @daisy: daisy chain address (-1 for no daisy chain address)
- *
- * This tries to locate a device on the given parallel port,
- * multiplexor port and daisy chain address, and returns its
- * device number or %-ENXIO if no device with those coordinates
- * exists.
- **/
-
-int parport_device_num(int parport, int mux, int daisy)
-{
-   int res = -ENXIO;
-   struct daisydev *dev;
-
-   spin_lock(&topology_lock);
-   dev = topology;
-   while (dev && dev->port->portnum != parport &&
-  dev->port->muxport != mux && dev->daisy != daisy)
-   dev = dev->next;
-   if (dev)
-   res = dev->devnum;
-   spin_unlock(&topology_lock);
-
-   return res;
-}
-
 /* Send a daisy-chain-style CPP command packet. */
 static int cpp_daisy(struct parport *port, int cmd)
 {
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 9cdd694..ec3f765 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -510,7 +510,6 @@ extern struct pardevice *parport_open (int devnum, const 
char *name,
   int flags, void *handle);
 extern void parport_close (struct pardevice *dev);
 extern ssize_t parport_device_id (int devnum, char *buffer, size_t len);
-extern int parport_device_num (int parport, int mux, int daisy);
 extern void parport_daisy_deselect_all (struct parport *port);
 extern int parport_daisy_select (struct parport *port, int daisy, int mode);
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] make do_restart_poll() static

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 02:06:48AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.23-rc2-mm2:
>...
> +use-erestart_restartblock-if-poll-is-interrupted-by-a-signal.patch
>...
>  The infamous misc
>...

do_restart_poll() can become static.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---
59cd2d11f5f0189973bb280c59262eb50984cb88 
diff --git a/fs/select.c b/fs/select.c
index 5a3ab01..3e515aa 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -711,7 +711,7 @@ out_fds:
return err;
 }
 
-long do_restart_poll(struct restart_block *restart_block)
+static long do_restart_poll(struct restart_block *restart_block)
 {
struct pollfd __user *ufds = (struct pollfd __user*)restart_block->arg0;
int nfds = restart_block->arg1;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] unexport snd_ctl_elem_{read,write}

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 02:06:48AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.23-rc2-mm2:
>...
>  git-alsa.patch
>...
>  git trees
>...

snd_ctl_elem_{read,write} no longer have any modular users.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 sound/core/control.c |4 
 1 file changed, 4 deletions(-)

23e15051dde57c569e4c9aff1339aaf64185ea71 
diff --git a/sound/core/control.c b/sound/core/control.c
index 396e98e..6144d8a 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -716,8 +716,6 @@ int snd_ctl_elem_read(struct snd_card *card, struct 
snd_ctl_elem_value *control)
return result;
 }
 
-EXPORT_SYMBOL(snd_ctl_elem_read);
-
 static int snd_ctl_elem_read_user(struct snd_card *card,
  struct snd_ctl_elem_value __user *_control)
 {
@@ -781,8 +779,6 @@ int snd_ctl_elem_write(struct snd_card *card, struct 
snd_ctl_file *file,
return result;
 }
 
-EXPORT_SYMBOL(snd_ctl_elem_write);
-
 static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
   struct snd_ctl_elem_value __user *_control)
 {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] unexport sys_{open,read}

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 02:06:48AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.23-rc2-mm2:
>...
>  git-alsa.patch
>...
>  git trees
>...

sys_{open,read} can finally be unexported.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 fs/open.c   |1 -
 fs/read_write.c |1 -
 2 files changed, 2 deletions(-)

6f6884f9ee675f2e804c6c58ca46337f9765dd0d 
diff --git a/fs/open.c b/fs/open.c
index 23f334d..c0814de 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1057,7 +1057,6 @@ asmlinkage long sys_open(const char __user *filename, int 
flags, int mode)
prevent_tail_call(ret);
return ret;
 }
-EXPORT_SYMBOL_GPL(sys_open);
 
 asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
   int mode)
diff --git a/fs/read_write.c b/fs/read_write.c
index 507ddff..d913d1e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -370,7 +370,6 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * 
buf, size_t count)
 
return ret;
 }
-EXPORT_SYMBOL_GPL(sys_read);
 
 asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t 
count)
 {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] make types.h usable for non-gcc C parsers

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 03:33:27PM +0200, Gabriel C wrote:
>...
> WARNING: "div64_64" [net/netfilter/xt_connbytes.ko] has no CRC!
>...

Patch below.

> Regards,
> 
> Gabriel

cu
Adrian


<--  snip  -->


This patch makes the 64bit integers on 32bit architectures usable for
all C parsers that know about "long long".

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 include/asm-arm/types.h  |   10 +++---
 include/asm-avr32/types.h|   10 +++---
 include/asm-blackfin/types.h |   11 +++
 include/asm-cris/types.h |   10 +++---
 include/asm-frv/types.h  |   10 +++---
 include/asm-h8300/types.h|   10 +++---
 include/asm-i386/types.h |   10 +++---
 include/asm-m32r/types.h |   11 ---
 include/asm-m68k/types.h |   10 +++---
 include/asm-mips/types.h |   10 +++---
 include/asm-parisc/types.h   |   10 +++---
 include/asm-powerpc/types.h  |9 ++---
 include/asm-s390/types.h |9 ++---
 include/asm-sh/types.h   |   10 +++---
 include/asm-sh64/types.h |   10 +++---
 include/asm-v850/types.h |   10 +++---
 include/asm-xtensa/types.h   |   10 +++---
 17 files changed, 118 insertions(+), 52 deletions(-)

4b6826d7a2f5b54a6a3b1cfa8cd40b1b27621be0 
diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h
index 3141451..1dae25b 100644
--- a/include/asm-arm/types.h
+++ b/include/asm-arm/types.h
@@ -19,11 +19,15 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__)
-__extension__ typedef __signed__ long long __s64;
-__extension__ typedef unsigned long long __u64;
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#define __extension_long_long __extension__
+#else
+#define __extension_long_long
 #endif
 
+__extension_long_long typedef __signed__ long long __s64;
+__extension_long_long typedef unsigned long long __u64;
+
 #endif /* __ASSEMBLY__ */
 
 /*
diff --git a/include/asm-avr32/types.h b/include/asm-avr32/types.h
index 8999a38..2c14f49 100644
--- a/include/asm-avr32/types.h
+++ b/include/asm-avr32/types.h
@@ -25,11 +25,15 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__)
-__extension__ typedef __signed__ long long __s64;
-__extension__ typedef unsigned long long __u64;
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#define __extension_long_long __extension__
+#else
+#define __extension_long_long
 #endif
 
+__extension_long_long typedef __signed__ long long __s64;
+__extension_long_long typedef unsigned long long __u64;
+
 #endif /* __ASSEMBLY__ */
 
 /*
diff --git a/include/asm-blackfin/types.h b/include/asm-blackfin/types.h
index 9785a6d..d0666b9 100644
--- a/include/asm-blackfin/types.h
+++ b/include/asm-blackfin/types.h
@@ -26,12 +26,15 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-/* HK0617   -- Changes to unsigned long temporarily */
-#if defined(__GNUC__)
-__extension__ typedef __signed__ long long __s64;
-__extension__ typedef unsigned long long __u64;
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#define __extension_long_long __extension__
+#else
+#define __extension_long_long
 #endif
 
+__extension_long_long typedef __signed__ long long __s64;
+__extension_long_long typedef unsigned long long __u64;
+
 #endif /* __ASSEMBLY__ */
 /*
  * These aren't exported outside the kernel to avoid name space clashes
diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h
index 5a21c42..6c46a90 100644
--- a/include/asm-cris/types.h
+++ b/include/asm-cris/types.h
@@ -19,11 +19,15 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__)
-__extension__ typedef __signed__ long long __s64;
-__extension__ typedef unsigned long long __u64;
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#define __extension_long_long __extension__
+#else
+#define __extension_long_long
 #endif
 
+__extension_long_long typedef __signed__ long long __s64;
+__extension_long_long typedef unsigned long long __u64;
+
 #endif /* __ASSEMBLY__ */
 
 /*
diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h
index 767e5ed..728c234 100644
--- a/include/asm-frv/types.h
+++ b/include/asm-frv/types.h
@@ -30,11 +30,15 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__)
-__extension__ typedef __signed__ long long __s64;
-__extension__ typedef unsigned long long __u64;
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#define __extension_long_long __extension__
+#else
+#define __extension_long_long
 #endif
 
+__extension_long_long typedef __signed__ long long __s64;
+__extension_long_long typedef unsigned long long __u64;
+
 #endif /* __ASSEMBLY__ */
 
 /*
diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h
index 56566e2..1fc2dd9 100644
--- a/include/asm-h8

2.6.23-rc3-mm1: m32r defconfig compile error

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 02:06:48AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.23-rc2-mm2:
>...
>  git-m32r.patch
>...
>  git trees
>...

<--  snip  -->

...
  AS  arch/m32r/kernel/entry.o
/home/bunk/linux/kernel-2.6/linux-2.6.23-rc3-mm1/arch/m32r/kernel/entry.S: 
Assembler messages:
/home/bunk/linux/kernel-2.6/linux-2.6.23-rc3-mm1/arch/m32r/kernel/entry.S:358: 
Error: bad instruction `addi r0,#(0)+(64))+(32))+(32)))'
make[2]: *** [arch/m32r/kernel/entry.o] Error 1

<--  snip  -->

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] remove unwind exports

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 02:06:48AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.23-rc2-mm2:
>...
> +x86_64-mm-unwinder.patch
>...
>  x86 tree updates
>...

This patch removes the unused unwind exports.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 kernel/unwind.c |4 
 1 file changed, 4 deletions(-)

844ccf670a8204df45b89407bb0e5867f03d0f71 
diff --git a/kernel/unwind.c b/kernel/unwind.c
index 8c267c7..adb1ebe 100644
--- a/kernel/unwind.c
+++ b/kernel/unwind.c
@@ -1243,7 +1243,6 @@ int unwind(struct unwind_frame_info *frame)
 #undef CASES
 #undef FRAME_REG
 }
-EXPORT_SYMBOL(unwind);
 
 int unwind_init_frame_info(struct unwind_frame_info *info,
struct task_struct *tsk,
@@ -1255,7 +1254,6 @@ int unwind_init_frame_info(struct unwind_frame_info *info,
 
return 0;
 }
-EXPORT_SYMBOL(unwind_init_frame_info);
 
 /*
  * Prepare to unwind a blocked task.
@@ -1269,7 +1267,6 @@ int unwind_init_blocked(struct unwind_frame_info *info,
 
return 0;
 }
-EXPORT_SYMBOL(unwind_init_blocked);
 
 /*
  * Prepare to unwind the currently running thread.
@@ -1284,5 +1281,4 @@ int unwind_init_running(struct unwind_frame_info *info,
 
return arch_unwind_init_running(info, callback, arg);
 }
-EXPORT_SYMBOL(unwind_init_running);
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[2.6 patch] fix SERIAL_CORE_CONSOLE driver dependencies

2007-08-27 Thread Adrian Bunk
SERIAL_BFIN=m or SERIAL_MUX=m shouldn't allow SERIAL_CORE_CONSOLE=y.

Additionally, this patch fixes whitespaceinstead of tabs at the 
SERIAL_MUX_CONSOLE option.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 drivers/serial/Kconfig |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

d07b60e6784eb178d4ba7dd8ff9923f2e54d3ef1 
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 4e28992..7780d76 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -611,7 +611,7 @@ config SERIAL_BFIN
 
 config SERIAL_BFIN_CONSOLE
bool "Console on Blackfin serial port"
-   depends on SERIAL_BFIN
+   depends on SERIAL_BFIN=y
select SERIAL_CORE_CONSOLE
 
 choice
@@ -832,10 +832,10 @@ config SERIAL_MUX
4. Change the kernel command console parameter to: console=ttyB0
 
 config SERIAL_MUX_CONSOLE
-bool "Support for console on serial MUX"
-depends on SERIAL_MUX
+   bool "Support for console on serial MUX"
+   depends on SERIAL_MUX=y
select SERIAL_CORE_CONSOLE
-default y
+   default y
 
 config PDC_CONSOLE
bool "PDC software console support"

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] unexport noautodma

2007-08-27 Thread Adrian Bunk
On Wed, Aug 22, 2007 at 02:06:48AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.23-rc2-mm2:
>...
> +ide-ide-remove-hwif-autodma-and-drive-autodma.patch
>...
>  IDE tree updates
>...

noautodma can now be unexported.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---
957dc7601c050cb14a7afc842db0c2d62aaf3509 
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index b3b5f00..5b09066 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -100,8 +100,6 @@ static int ide_scan_direction; /* THIS was formerly 2.2.x 
pci=reverse */
 
 int noautodma = 0;
 
-EXPORT_SYMBOL(noautodma);
-
 #ifdef CONFIG_BLK_DEV_IDEACPI
 int ide_noacpi = 0;
 int ide_noacpitfs = 1;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC: 2.6 patch] remove include/asm-*/ipc.h

2007-08-27 Thread Adrian Bunk
All asm/ipc.h files do only #include .

This patch therefore removes all include/asm-*/ipc.h files and moves the
contents of include/asm-generic/ipc.h to include/linux/ipc.h.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

This patch has been sent on:
- 14 Aug 2007

 arch/arm/kernel/sys_arm.c |2 -
 arch/arm/kernel/sys_oabi-compat.c |2 -
 arch/cris/kernel/sys_cris.c   |2 -
 arch/frv/kernel/sys_frv.c |2 -
 arch/h8300/kernel/sys_h8300.c |2 -
 arch/i386/kernel/sys_i386.c   |2 -
 arch/m32r/kernel/sys_m32r.c   |2 -
 arch/m68k/kernel/sys_m68k.c   |2 -
 arch/m68knommu/kernel/sys_m68k.c  |2 -
 arch/mips/kernel/linux32.c|2 -
 arch/mips/kernel/syscall.c|2 -
 arch/powerpc/kernel/sys_ppc32.c   |2 -
 arch/powerpc/kernel/syscalls.c|1 
 arch/s390/kernel/compat_linux.c   |2 -
 arch/s390/kernel/sys_s390.c   |2 -
 arch/sh/kernel/sys_sh.c   |2 -
 arch/sh64/kernel/sys_sh64.c   |2 -
 arch/sparc/kernel/sys_sparc.c |2 -
 arch/sparc64/kernel/sys_sparc.c   |1 
 arch/sparc64/kernel/sys_sparc32.c |1 
 arch/sparc64/solaris/ipc.c|2 -
 arch/um/sys-i386/syscalls.c   |2 -
 arch/v850/kernel/syscalls.c   |1 
 arch/x86_64/ia32/ipc32.c  |2 -
 include/asm-arm/ipc.h |1 
 include/asm-blackfin/ipc.h|1 
 include/asm-cris/ipc.h|1 
 include/asm-frv/ipc.h |1 
 include/asm-generic/Kbuild|1 
 include/asm-generic/ipc.h |   31 --
 include/asm-h8300/ipc.h   |1 
 include/asm-i386/ipc.h|1 
 include/asm-m32r/ipc.h|1 
 include/asm-m68k/ipc.h|1 
 include/asm-m68knommu/ipc.h   |1 
 include/asm-mips/ipc.h|1 
 include/asm-powerpc/Kbuild|1 
 include/asm-powerpc/ipc.h |1 
 include/asm-s390/ipc.h|1 
 include/asm-sh/ipc.h  |1 
 include/asm-sh64/ipc.h|1 
 include/asm-sparc/ipc.h   |1 
 include/asm-sparc64/Kbuild|1 
 include/asm-sparc64/ipc.h |1 
 include/asm-um/ipc.h  |1 
 include/asm-v850/ipc.h|1 
 include/linux/ipc.h   |   28 +++
 47 files changed, 47 insertions(+), 77 deletions(-)

b5279b2d504505e30ac40855e0f4219aa3ab706f 
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 4d25e49..9bd1870 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -26,9 +26,9 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
-#include 
 
 extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
   unsigned long new_len, unsigned long flags,
diff --git a/arch/arm/kernel/sys_oabi-compat.c 
b/arch/arm/kernel/sys_oabi-compat.c
index 8e2f9bc..e8b9804 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -80,7 +80,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 struct oldabi_stat64 {
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 0aa0e0e..514359b 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -21,9 +21,9 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
-#include 
 #include 
 
 /*
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
index 6fbe266..04c6b16 100644
--- a/arch/frv/kernel/sys_frv.c
+++ b/arch/frv/kernel/sys_frv.c
@@ -23,10 +23,10 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
-#include 
 
 /*
  * sys_pipe() is the normal C calling standard for creating
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index ddc6272..00608be 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -19,12 +19,12 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 /*
diff --git a/arch/i386/kernel/sys_i386.c b/arch/i386/kernel/sys_i386.c
index 4214730..4700845 100644
--- a/arch/i386/kernel/sys_i386.c
+++ b/arch/i386/kernel/sys_i386.c
@@ -19,10 +19,10 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
-#include 
 
 /*
  * sys_pipe() is the normal C calling standard for creating
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index b13dbbe..0fc2efe 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -20,11 +20,11 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 36d78cf..e892f17 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -21,12 +21,12 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include

  1   2   3   4   5   >