[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac1a099b-2e7e-8001-24a2-679a0b7077a5@suse.cz>
Date: Wed, 13 Sep 2017 08:04:57 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: Jibin Xu <jibin.xu@...driver.com>, gregkh@...uxfoundation.org
Cc: rmk+kernel@...linux.org.uk, mingo@...e.hu,
linux-arm-kernel@...ts.infradead.org, riel@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: Re: [PATCH] sysrq : fix Show Regs call trace on ARM
On 09/11/2017, 01:22 PM, Jibin Xu wrote:
> Hi,Jiri:
>
> I tested get_irq_regs() behave in the softirq context,
> I called get_irq_regs() by a tasklet, It returns NULL.My understanding is get_irq_regs() can return the right result
> only in hardware IRQ,otherwise it returns NULL.
> So I think in_irq() would be better.
Hi,
tasklets are run in the process context (in a kthread). But what about
timers? HARDIRQ is decremented, SOFTIRQ remains set and sysrq handlers
are called in such conditions (in_interrupt() is true, in_irq() is
false). At that moment, irq_regs are still set and valid IMO.
But I would believe for now that sysrq handlers are not invoked from
softirq context. AFAIK they are called only from hardirq (serial port or
keyboard IRQ handler) or process context (write to /proc/sysrq-trigger).
So this change *should* be safe unless someone else objects there are
some kgdb special cases or something.
> thanks,
> Jibin Xu
>
> On 2017å¹´09æ11æ¥ 17:55, Jibin Xu wrote:
>
>> Hi,Jiri:
>> get_irq_regs() in the softirq context return NULL.
>> thanks,
>> Jibin Xu
>> On 2017å¹´09æ11æ¥ 13:24, Jiri Slaby wrote:
>>> On 09/11/2017, 05:11 AM, Jibin Xu wrote:
>>> ...
>>>> --- a/drivers/tty/sysrq.c
>>>> +++ b/drivers/tty/sysrq.c
>>>> @@ -245,8 +245,10 @@ static void sysrq_handle_showallcpus(int key)
>>>> Â Â Â Â Â Â * architecture has no support for it:
>>>> Â Â Â Â Â Â */
>>>> Â Â Â Â Â if (!trigger_all_cpu_backtrace()) {
>>>> -Â Â Â Â Â Â Â struct pt_regs *regs = get_irq_regs();
>>>> +Â Â Â Â Â Â Â struct pt_regs *regs = NULL;
>>>> Â
>>>> +Â Â Â Â Â Â Â if (in_irq())
>>>> +Â Â Â Â Â Â Â Â Â Â Â regs = get_irq_regs();
>>> Maybe a stupid question: how does get_irq_regs() behave in the softirq
>>> context? I.e. what about s/in_irq/in_interrupt/?
>>> thanks,
>>
>
--
js
suse labs
Powered by blists - more mailing lists