All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, greg@kroah.com, vojtech@suse.cz
Subject: Re: [RFC] Changing SysRq - show registers handling
Date: Thu, 3 Jun 2004 02:08:19 -0500	[thread overview]
Message-ID: <200406030208.19612.dtor_core@ameritech.net> (raw)
In-Reply-To: <20040602235306.1e6dd3fb.akpm@osdl.org>

On Thursday 03 June 2004 01:53 am, Andrew Morton wrote:
> Dmitry Torokhov <dtor_core@ameritech.net> wrote:
> >
> > Currently SysRq "show registers" command dumps registers and the call
> >  trace from keyboard interrupt context when SysRq-P. For that struct pt_regs *
> >  has to be dragged throughout entire input and USB systems. Other than passing
> >  this pointer to SysRq handler these systems has no interest in it, it is
> >  completely foreign piece of data for them and I would like to get rid of it.
> > 
> >  I am suggesting slightly changing semantics of SysRq-P handling - instread
> >  of dumping registers and call trace immediately it will simply post a request
> >  for this information to be dumped. When next HW interrupt arrives and is
> >  handled, before running softirqs then current stack trace will be printed.
> >  This approach adds small overhead to the HW interrupt handling routine as the
> >  condition has to be checked with every interrupt but I expect it to be
> >  negligible as it is only check and conditional jump that is almost never
> >  taken. The code should be hot in cache so branch prediction should work just
> >  fine.
> 
> Makes sense I guess.
> 
> There have been other times when I've needed access to the registers from
> within hard IRQ.  But I forget the reason.
> 
> It would be more general, although a little slower to do:
> 
> DEFINE_PER_CPU(global_irq_regs);
> 
> do_IRQ(...)
> {
> 	...
> 	struct pt_regs **cpu_regs_slot = __get_cpu_var(global_irq_regs);
> 	struct pt_regs *save = *cpu_regs_slot;
> 	*cpu_regs_slot = &regs;
> 	...
> 	*cpu_regs_slot = save;
> }
> 
> And to teach the sysrq code to grab *__get_cpu_var(global_irq_regs).

Ok, so by making it a tad slower you can keep the old semantics - printing
registers right when keyboard interrupt is processed instead of waiting till
the next one arrives.

Hmm... the path is pretty hot, I am not sure what is best.

> 
> Note that global_irq_regs is only valid if in_interrupt().  The sysrq
> handler can be called from process context via /proc/sysrq-trigger and
> should bale out if !in_interrupt().
> 
> +static inline void sysrq_show_registes(struct pt_regs *pt_regs)
> 
> typo.
> 

Yep, thanks for noticing.

-- 
Dmitry

  reply	other threads:[~2004-06-03  7:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-03  6:34 [RFC] Changing SysRq - show registers handling Dmitry Torokhov
2004-06-03  6:53 ` Andrew Morton
2004-06-03  7:08   ` Dmitry Torokhov [this message]
2004-06-03  7:18     ` Andrew Morton
2004-06-03  7:27       ` Dmitry Torokhov
2004-06-03  7:39         ` Andrew Morton
2004-06-03  7:44         ` Oliver Neukum
2004-06-03 21:06           ` Theodore Ts'o
2004-06-03 22:21             ` Keith Owens
     [not found] <fa.jjf8osn.670mbt@ifi.uio.no>
2004-06-03  7:03 ` Andy Lutomirski
2004-06-03  7:15   ` Dmitry Torokhov

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=200406030208.19612.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /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.