Re: [PATCH] x86/irq: Preserve vector in orig_ax for APIC code
From: Graf (AWS), Alexander
Date: Wed Aug 26 2020 - 14:22:29 EST
> Am 26.08.2020 um 20:03 schrieb Andy Lutomirski <luto@xxxxxxxxxx>:
>
>> On Wed, Aug 26, 2020 at 10:47 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>>
>> Andy,
>>
>>> On Wed, Aug 26 2020 at 09:13, Andy Lutomirski wrote:
>>> On Wed, Aug 26, 2020 at 7:27 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>>>> The below nasty hack cures it, but I hate it with a passion. I'll look
>>>> deeper for a sane variant.
>>>>
>>> Fundamentally, the way we overload orig_ax is problematic. I have a
>>> half-written series to improve it, but my series is broken. I think
>>> it's fixable, though.
>>>
>>> First is this patch to use some __csh bits to indicate the entry type.
>>> As far as I know, this patch is correct:
>>>
>>> https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/commit/?h=x86/entry&id=dfff54208072a27909ae97ebce644c251a233ff2
>>
>> Yes, that looks about right.
>>
>>> Then I wrote this incorrect patch:
>>>
>>> https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/commit/?h=x86/entry&id=3a5087acb8a2cc1e88b1a55fa36c2f8bef370572
>>>
>>> That one is wrong because the orig_ax wreckage seems to have leaked
>>> into user ABI -- user programs think that orig_ax has certain
>>> semantics on user-visible entries.
>>
>> Yes, orig_ax is pretty much user ABI for a very long time.
>>
>>> But I think that the problem in this thread could be fixed quite
>>> nicely by the first patch, plus a new CS_ENTRY_IRQ and allocating
>>> eight bits of __csh to store the vector. Then we could read out the
>>> vector.
>>
>> That works. Alternatively I can just store the vector in the irq
>> descriptor itself. That's trivial enough and can be done completely in C
>> independent of the stuff above.
>
> The latter sounds quite sensible to me. It does seem vaguely
> ridiculous to be trying to fish the vector out of pt_regs in the APIC
> code.
I like that option much better than the orig_ax hacks. Is this going to be something useable enough for stable?
Also, Thomas, will you have a look at moving the vector info? If so, I'd hold still on this patch for a bit.
Alex
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879