linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Enlin Mu <enlinmu@gmail.com>
Cc: John Ogness <john.ogness@linutronix.de>,
	Enlin Mu <enlin.mu@outlook.com>,
	rostedt@goodmis.org, senozhatsky@chromium.org,
	keescook@chromium.org, tony.luck@intel.com, gpiccoli@igalia.com,
	enlin.mu@unisoc.com, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] printk: add cpu id information to printk() output
Date: Fri, 22 Sep 2023 09:47:44 +0200	[thread overview]
Message-ID: <ZQ1GoF4LjwRM2Ec3@alley> (raw)
In-Reply-To: <CAAfh-jOnirbUjUYDhWqqUe8kPL=1FcDdZoSax5R-nGwO1CO60g@mail.gmail.com>

On Fri 2023-09-22 15:34:44, Enlin Mu wrote:
> John Ogness <john.ogness@linutronix.de> 于2023年9月15日周五 16:34写道:
> >
> > On 2023-09-15, Enlin Mu <enlin.mu@outlook.com> wrote:
> > > Sometimes we want to print cpu id of printk() messages to consoles
> > >
> > > diff --git a/include/linux/threads.h b/include/linux/threads.h
> > > index c34173e6c5f1..6700bd9a174f 100644
> > > --- a/include/linux/threads.h
> > > +++ b/include/linux/threads.h
> > > @@ -34,6 +34,9 @@
> > >  #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
> > >       (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
> > >
> > > +#define CPU_ID_SHIFT 23
> > > +#define CPU_ID_MASK  0xff800000
> >
> > This only supports 256 CPUs. I think it doesn't make sense to try to
> > squish CPU and Task IDs into 32 bits.
> >
> > What about introducing a caller_id option to always only print the CPU
> > ID? Or do you really need Task _and_ CPU?
>
> Yes, I need it.
> For SOC manufacturer, sometimes cpu is not stable, we need some debug
> tools for this exceptions.
> When an exception occurs, we may not be able to detect it in a timely
> manner, but through Task _and_ CPU, we can roughly locate the CPU at
> the time of the exception.

Would frace be enough in this case? It has already been suggested
earlier.

The problem is that adding CPU into would require changes in
the metadata stored in the ring buffer. And it would require
updating userspace tools which read the log from a crash dump.
It means that such a feature would need a lot of effort.
And I would prefer to avoid it when there is another solution.

If you debug the problem by adding extra printk messages
you might also print the current CPU in the debug messages.

Best Regards,
Petr

  reply	other threads:[~2023-09-22  7:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15  7:40 [PATCH] printk: add cpu id information to printk() output Enlin Mu
2023-09-15  8:34 ` John Ogness
2023-09-15  8:46   ` Enlin Mu
2023-09-15  9:53     ` Greg KH
2023-09-15 16:32       ` Petr Mladek
2023-09-18  8:54         ` John Ogness
2023-09-22  7:20         ` Enlin Mu
2023-09-22  8:03           ` Petr Mladek
2023-09-22  7:34   ` Enlin Mu
2023-09-22  7:47     ` Petr Mladek [this message]
2023-09-15  9:51 ` Greg KH
2023-09-15 16:31 ` Luck, Tony

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=ZQ1GoF4LjwRM2Ec3@alley \
    --to=pmladek@suse.com \
    --cc=enlin.mu@outlook.com \
    --cc=enlin.mu@unisoc.com \
    --cc=enlinmu@gmail.com \
    --cc=gpiccoli@igalia.com \
    --cc=john.ogness@linutronix.de \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tony.luck@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).