From: Peter Zijlstra <peterz@infradead.org>
To: Huang Ying <ying.huang@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H.PeterA" <"nvin hpa"@zytor.com>,
linux-kernel@vger.kernel.org, Andi Kleen <andi@firstfloor.org>,
Chris Mason <chris.mason@oracle.com>
Subject: Re: [RFC 1/3] Unified NMI delayed call mechanism
Date: Fri, 18 Jun 2010 13:55:30 +0200 [thread overview]
Message-ID: <1276862130.1875.7.camel@laptop> (raw)
In-Reply-To: <1276334896-7075-1-git-send-email-ying.huang@intel.com>
On Sat, 2010-06-12 at 17:28 +0800, Huang Ying wrote:
> +#define NMI_DELAYED_CALL_ID_MAX 32
> +#define NMI_DELAYED_CALL_RESTART_MAX 5
> +
> +static nmi_delayed_call_func_t nmi_delayed_call_funcs[NMI_DELAYED_CALL_ID_MAX];
> +static DEFINE_SPINLOCK(nmi_delayed_call_lock);
> +
> +static DEFINE_PER_CPU(unsigned long, nmi_delayed_call_pending);
> +
> +static void nmi_delayed_call_run(void)
> +{
> + int cpu, restart = NMI_DELAYED_CALL_RESTART_MAX;
> + unsigned long pending, *ppending;
> + nmi_delayed_call_func_t *pfunc, func;
> +
> + cpu = smp_processor_id();
> + ppending = per_cpu_ptr(&nmi_delayed_call_pending, cpu);
> + while (*ppending && restart--) {
> + pending = xchg(ppending, 0);
> + pfunc = nmi_delayed_call_funcs;
> + do {
> + if (pending & 1) {
> + func = *pfunc;
> + if (func)
> + func();
> + }
> + pfunc++;
> + pending >>= 1;
> + } while (pending);
> + }
> +}
So aside from the should this be perf or not, the above is utter
gibberish. Whoever came up with this nonsense?
Why not make a work_struct like thing and enqueue it using cmpxchg on a
percpu list, then have the interrupt process them. Read
perf_pending_queue() and __perf_pending_run().
That way you don't need this whole register/id/limit crap.
> +#ifdef CONFIG_X86_LOCAL_APIC
What's the point of the rest of this code if we don't have a lapic?
> +asmlinkage void smp_nmi_delayed_call_interrupt(struct pt_regs *regs)
> +{
> + ack_APIC_irq();
> + irq_enter();
You're missing inc_irq_stat() there.
> + nmi_delayed_call_run();
> + irq_exit();
> +}
> +#endif
next prev parent reply other threads:[~2010-06-18 11:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-12 9:28 [RFC 1/3] Unified NMI delayed call mechanism Huang Ying
2010-06-12 9:28 ` [RFC 2/3] Use unified NMI delayed call mechanism in MCE handler Huang Ying
2010-06-12 9:28 ` [RFC 3/3] Use unified NMI delayed call mechanism in perf event NMI handler Huang Ying
2010-06-12 10:25 ` [RFC 1/3] Unified NMI delayed call mechanism Ingo Molnar
2010-06-13 1:54 ` Huang Ying
2010-06-14 3:45 ` Hidetoshi Seto
2010-06-14 13:54 ` Don Zickus
2010-06-14 14:44 ` Andi Kleen
2010-06-14 15:12 ` Don Zickus
2010-06-18 10:30 ` Ingo Molnar
2010-06-18 9:48 ` Ingo Molnar
2010-06-18 11:34 ` huang ying
2010-06-18 12:45 ` Ingo Molnar
2010-06-18 13:40 ` huang ying
2010-06-18 14:35 ` Ingo Molnar
2010-06-18 15:16 ` huang ying
2010-06-18 15:31 ` Peter Zijlstra
2010-06-19 1:51 ` huang ying
2010-06-19 8:02 ` Andi Kleen
2010-06-19 10:53 ` Ingo Molnar
2010-06-19 14:07 ` huang ying
2010-06-19 14:24 ` Andi Kleen
2010-06-18 11:55 ` Peter Zijlstra [this message]
2010-06-18 12:25 ` Andi Kleen
2010-06-18 12:48 ` Peter Zijlstra
2010-06-18 13:09 ` Andi Kleen
2010-06-18 13:12 ` Peter Zijlstra
2010-06-18 13:23 ` Andi Kleen
2010-06-18 13:24 ` Peter Zijlstra
2010-06-18 14:37 ` Ingo Molnar
2010-06-19 14:17 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1276862130.1875.7.camel@laptop \
--to=peterz@infradead.org \
--cc="nvin hpa"@zytor.com \
--cc=andi@firstfloor.org \
--cc=chris.mason@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox