Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

From: Rasmus Villemoes
Date: Tue Apr 02 2019 - 15:02:42 EST


On 02/04/2019 17.48, Thomas Gleixner wrote:
> On Tue, 2 Apr 2019, Josh Poimboeuf wrote:
>> On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote:
>>> +/*
>>> + * Array of exception stack page descriptors. If the stack is larger than
>>> + * PAGE_SIZE, all pages covering a particular stack will have the same
>>> + * info.
>>> + */
>>> +static const struct estack_pages estack_pages[ESTACK_PAGES] ____cacheline_aligned = {
>>> + [CONDRANGE(DF)] = ESTACK_PAGE(DOUBLEFAULT_IST, DF),
>>> + [CONDRANGE(NMI)] = ESTACK_PAGE(NMI_IST, NMI),
>>> + [PAGERANGE(DB)] = ESTACK_PAGE(DEBUG_IST, DB),
>>> + [CONDRANGE(MCE)] = ESTACK_PAGE(MCE_IST, MCE),
>>
>> It would be nice if the *_IST macro naming aligned with the struct
>> cea_exception_stacks field naming. Then you could just do, e.g.
>> ESTACKPAGE(DF).
>
> Yes, lemme fix that up.
>
>> Also it's a bit unfortunate that some of the stack size knowledge is
>> hard-coded here, i.e #DB always being > 1 page and non-#DB being
>> sometimes 1 page.
>
> The problem is that there is no way to make this macro maze conditional on
> sizeof(). But my macro foo is rusty.

Eh, but why do you need the CONDRANGE thing at all? [5 ... 5] is a
perfectly fine designator, equivalent to [5]. So you can just use
PAGERANGE in all cases, no?

Rasmus