[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1202582388.16505.8.camel@lappy>
Date: Sat, 09 Feb 2008 19:39:47 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Arjan van de Ven <arjan@...radead.org>
Cc: Pekka Paalanen <pq@....fi>, Ingo Molnar <mingo@...e.hu>,
Christoph Hellwig <hch@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] x86: explicit call to mmiotrace in do_page_fault()
On Sat, 2008-02-09 at 10:01 -0800, Arjan van de Ven wrote:
> > default n
> > help
> > This will build a kernel module called mmiotrace.
> > + Making this a built-in is heavily discouraged.
>
> why is this? Wouldn't it be nice if distros just shipped with this in their kernel by default
> for example?
so default m?
> > -#ifdef CONFIG_PAGE_FAULT_HANDLERS
> > -static HLIST_HEAD(pf_handlers); /* protected by RCU */
> > -static DEFINE_SPINLOCK(pf_handlers_writer);
> > +#ifdef CONFIG_MMIOTRACE_HOOKS
> > +static pf_handler_func mmiotrace_pf_handler; /* protected by RCU */
> > +static DEFINE_SPINLOCK(mmiotrace_handler_lock);
> >
> > -void register_page_fault_handler(struct pf_handler *new_pfh)
> > +int mmiotrace_register_pf(pf_handler_func new_pfh)
> > {
> > + int ret = 0;
> > unsigned long flags;
> > - spin_lock_irqsave(&pf_handlers_writer, flags);
> > - hlist_add_head_rcu(&new_pfh->hlist, &pf_handlers);
> > - spin_unlock_irqrestore(&pf_handlers_writer, flags);
> > + spin_lock_irqsave(&mmiotrace_handler_lock, flags);
> > + if (mmiotrace_pf_handler)
> > + ret = -EBUSY;
> > + else
> > + mmiotrace_pf_handler = new_pfh;
> > + spin_unlock_irqrestore(&mmiotrace_handler_lock, flags);
> > + return ret;
> > }
> > -EXPORT_SYMBOL_GPL(register_page_fault_handler);
> > +EXPORT_SYMBOL_GPL(mmiotrace_register_pf);
>
> why not use a weak function instead? should be a ton simpler.
AFAIC weak functions are a built time thing, not fixed up on module
load. So I'm not seeing the applicability there.
Also, it would force a function call, even for the unlikely case the
tracer is set.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists