From: Alex Williamson <alex_williamson@hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH] New CMC/CPE polling
Date: Mon, 04 Aug 2003 21:15:33 +0000 [thread overview]
Message-ID: <marc-linux-ia64-106003174416758@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105969308328993@msgid-missing>
"Luck, Tony" wrote:
>
> > You might be right on the clearing side, I think moving it down
> > a couple lines and disabling local interrupts would eliminate the
> > potential hole though. Something like this:
> >
> > ia64_mca_cmc_int_caller(...)
> > {
> > ...
> > smp_call_function(ia64_mca_cmc_vector_enable, NULL, 1, 0);
> > local_irq_disable();
> > ia64_mca_cmc_vector_enable(NULL);
> > cmc_polling_enabled = 0;
> > ...
> >
> > Does that address the race you were looking at? I don't see one
> > on the setting end, could you be more specific? The spinlock feels
> > like it does the trick to me. Thanks for the comments,
>
> My issue is that you check and set cmc_polling_enabled under the
> protection of a lock (cmc_history_lock ... I realise that this is
> mostly protecting the cmc_history[], but it also defends against
> multiple cpus taking a CMCI at the same time and all trying to
> switch over to polling mode).
>
> But you clear cmc_polling_enabled without the lock. So the race is
> between enabling the interrupt (on all cpus) and taking the next
> interrupt. The local_irq_disable() in the above fragment fixes that
> for the current cpu, but for other cpus you can end up in the handler
> with cmc_polling_enabled set to the wrong value.
>
> One way might be harmless, but I'm not sure which.
Tony,
I believe it is harmless. I make use of the spinlock when setting
cmc_polling_enabled to serialize the cpus. ia64_mca_cmc_int_handler()
can obviously have multiple CPUs in it at the same time. However,
the polling sequence is naturally serialized, so there will never
be more than one CPU in the block that clears cmc_polling_enabled.
I didn't feel it necessary to pull the spinlock out of the interrupt
handler when it wasn't needed.
With the modifications above, there is a tiny window where the
other CPUs could take a CMCI while the cmc_polling_enabled flag is in
the wrong state. IMHO, this doesn't really seem like a problem.
The goal of polling for CMCs is simply to make the system usable, not
to count every CMC that occurs. Forward progress towards setting
the flag in the right state is ensured by disabling interrupts, so
the window is guaranteed to be very small. FWIW, this is the same
state we're in between ia64_mca_init() and ia64_mca_late_init().
Alex
--
Alex Williamson HP Linux & Open Source Lab
next prev parent reply other threads:[~2003-08-04 21:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-31 23:06 [PATCH] New CMC/CPE polling Alex Williamson
2003-08-01 6:34 ` David Mosberger
2003-08-01 14:20 ` Alex Williamson
2003-08-04 18:26 ` Luck, Tony
2003-08-04 18:49 ` Alex Williamson
2003-08-04 20:43 ` Luck, Tony
2003-08-04 21:15 ` Alex Williamson [this message]
2003-08-04 21:53 ` Luck, Tony
2003-08-04 23:09 ` David Mosberger
2003-08-08 18:39 ` Bjorn Helgaas
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=marc-linux-ia64-106003174416758@msgid-missing \
--to=alex_williamson@hp.com \
--cc=linux-ia64@vger.kernel.org \
/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