From: "Kevin D. Kissell" <kevink@paralogos.com>
To: Maksim Rayskiy <maksim.rayskiy@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: ASID conflict after CPU hotplug
Date: Thu, 25 Nov 2010 07:57:48 -0800 [thread overview]
Message-ID: <4CEE877C.7020309@paralogos.com> (raw)
In-Reply-To: <AANLkTimuJLxG2KoibRxzcHkX3LoKsTWqJSF_e=ouFi+b@mail.gmail.com>
This approach certainly makes per_cpu_trap_init() more readable and
maintainable, but it has the downside of creating state and
infrastructure that have footprints elsewhere that add to global cruft
and complexity. Note that your patch, as written, wouldn't solve your
problem, because it doesn't include the code that would actually set and
clear the elements of your cpu_warm_boot[] array. If we do need to pay
attention to warm boot state elsewhere in the kernel (Does any other
architecture? That should be a clue...), then some bits in memory like
that should perhaps be defined (though I'd wonder why it couldn't be a
bit in some existing per-CPU state entity like cpu_data[]). Otherwise,
as I said earlier, the cleanest approach strikes me as one of resetting
the value of EntryHi as well as the ASID cache when the hotplug event
takes place. The cleanest possible outcome would be if one could *move*
the reset initialization of EntryHi from wherever it is now to
per_cpu_trap_init(), so there would be *zero* net additional code, but
it may be (it's Thanksgiving and I'm limited in time and internet
access, so I can't really go look for you) that it's initialized as a
side effect of something that happens repeatedly, such that actually
*moving* it would be dangerous. But if you have the time, try setting
up EntryHi explicitly and unconditionally in per_cpu_trap_init() and see
if it doesn't solve your initial problem.
Happy Holiday to you all,
/K.
On 11/24/10 7:03 PM, Maksim Rayskiy wrote:
> I certainly agree that it is a bad idea to look at the current value
> of asid_cache when figuring out if it is a warm or cold boot.
> I could not tell how the code ended up with this entryHi value after
> the hotplug. So, I can only address the simplest portion of issues you
> mentioned.
> How about we add a variable to tell warm restart from cold and
> preserve asid_cache across hotplug event. It is not much of an
> improvement over the original code, I must admit.
>
> Signed-off-by: Maksim Rayskiy<maksim.rayskiy@gmail.com>
>
> diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
> index d83f325..9116adb 100644
> --- a/arch/mips/kernel/traps.c
> +++ b/arch/mips/kernel/traps.c
> @@ -1489,6 +1489,8 @@ static int __init ulri_disable(char *s)
> }
> __setup("noulri", ulri_disable);
>
> +static int cpu_warm_boot[NR_CPUS];
> +
> void __cpuinit per_cpu_trap_init(void)
> {
> unsigned int cpu = smp_processor_id();
> @@ -1577,7 +1579,9 @@ void __cpuinit per_cpu_trap_init(void)
> }
> #endif /* CONFIG_MIPS_MT_SMTC */
>
> - cpu_data[cpu].asid_cache = ASID_FIRST_VERSION;
> + if (!cpu_warm_boot[cpu])
> + cpu_data[cpu].asid_cache = ASID_FIRST_VERSION;
> + cpu_warm_boot[cpu] = 1;
> TLBMISS_HANDLER_SETUP();
>
> atomic_inc(&init_mm.mm_count);
>
>
> On Mon, Nov 22, 2010 at 1:34 PM, Kevin D. Kissell<kevink@paralogos.com> wrote:
>> On 11/21/10 19:41, Ralf Baechle wrote:
>>> ...
>>> Need to think a little about potencial consequences of your suggested
>>> patch. It seems ok. Kevin, what do you think?
>>>
>> Since you ask, while I would imagine that Maksim's patch works fine for him,
>> I'm not sure that it's really the right fix. I never did succeed in getting
>> CPU hotplugging working back in the 2.6.18 days, so I don't know as much
>> about it as I'd like, but if per_cpu_trap_init() needs to be invoked on a
>> hot plugin event, and if its behavior needs to be different , I'd really,
>> really prefer to see that state propagated explicitly, rather than inferring
>> it from whatever happens to be in cache/memory at cpu_data[cpu].asid_cache.
>> But beyond that, if the problem arises because setting
>> cpu_data[cpu].asid_cache to a known initial state on a plugin event can
>> conflict with the residual content of EntryHi, rather than creating a
>> special case where we don't initialize the ASID cache, since we seem to be
>> (re)initializing a lot of other privileged state, why aren't we also setting
>> a known sane initial EntryHi value? Wouldn't that be a cleaner fix? (And
>> I don't mean that as a rhetorical question - there may be very good reasons
>> to let EntryHi values persist across hot unplug/plug events. I just can't
>> imagine them offhand over coffee.)
>>
>> /K.
>>
>>
next prev parent reply other threads:[~2010-11-25 15:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-17 18:49 [PATCH] MIPS: ASID conflict after CPU hotplug Maksim Rayskiy
2010-11-22 3:41 ` Ralf Baechle
2010-11-22 18:38 ` Maksim Rayskiy
2010-11-22 21:34 ` Kevin D. Kissell
[not found] ` <AANLkTimuJLxG2KoibRxzcHkX3LoKsTWqJSF_e=ouFi+b@mail.gmail.com>
2010-11-25 15:57 ` Kevin D. Kissell [this message]
[not found] ` <AANLkTinUSjvjwHVJoRW-Fr75WDfheq3hSM_hEBMsEUXK@mail.gmail.com>
2010-11-30 2:53 ` Kevin D. Kissell
2010-11-30 3:21 ` Maksim Rayskiy
2010-11-30 10:05 ` Kevin D. Kissell
2010-11-30 19:49 ` Maksim Rayskiy
2010-12-01 11:51 ` Sergei Shtylyov
2011-11-10 13:09 ` Ralf Baechle
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=4CEE877C.7020309@paralogos.com \
--to=kevink@paralogos.com \
--cc=linux-mips@linux-mips.org \
--cc=maksim.rayskiy@gmail.com \
--cc=ralf@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.