mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Jibin Xu <jibin.xu@windriver.com>, gregkh@linuxfoundation.org
Cc: rmk+kernel@armlinux.org.uk, mingo@elte.hu,
	linux-arm-kernel@lists.infradead.org, riel@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] sysrq : fix Show Regs call trace on ARM
Date: Wed, 13 Sep 2017 08:04:57 +0200	[thread overview]
Message-ID: <ac1a099b-2e7e-8001-24a2-679a0b7077a5@suse.cz> (raw)
In-Reply-To: <17da8267-c4aa-dc0f-1150-4fd5efe0073c@windriver.com>

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

  parent reply	other threads:[~2017-09-13  6:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11  3:11 Jibin Xu
2017-09-11  5:24 ` Jiri Slaby
2017-09-11  9:55   ` Jibin Xu
     [not found]     ` <17da8267-c4aa-dc0f-1150-4fd5efe0073c@windriver.com>
2017-09-13  6:04       ` Jiri Slaby [this message]
2017-09-13  6:14         ` Jiri Slaby

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=ac1a099b-2e7e-8001-24a2-679a0b7077a5@suse.cz \
    --to=jslaby@suse.cz \
    --cc=gregkh@linuxfoundation.org \
    --cc=jibin.xu@windriver.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=riel@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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

all inboxes | Powered by JetHome®