From: Petr Mladek <pmladek@suse.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
intel-gfx@lists.freedesktop.org,
"Steven Rostedt" <rostedt@goodmis.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Sergey Senozhatsky" <senozhatsky@chromium.org>,
"Matthew Wilcox" <willy@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 01/12] drm/i915: Indicate which pipe failed the fastset check overall
Date: Wed, 28 Feb 2024 10:55:42 +0100 [thread overview]
Message-ID: <Zd8CtrOmb8nfGBdl@alley> (raw)
In-Reply-To: <fa42285b-099e-4d2d-9368-58cea7f67010@rasmusvillemoes.dk>
On Wed 2024-02-28 09:32:37, Rasmus Villemoes wrote:
> On 27/02/2024 19.32, Ville Syrjälä wrote:
> > On Tue, Feb 27, 2024 at 10:38:10AM +0100, Rasmus Villemoes wrote:
> >> On 26/02/2024 15.57, Jani Nikula wrote:
> So if we really want to go down this road, I think it should be
> something like %pX{drm:whatever}, with core printf just looking up the
> token "drm" in a run-time list of registered callbacks (because I don't
> want vsprintf.c filled with random subsystems' formatting code), and
> that single callback would then be handed a pointer to the rest of the
> format string (i.e. the "whatever}..."), the pointer argument from the
> varargs, and the buf,end pair. But then we're back to trusting that
> callback (which might of course multiplex based on the "whatever" part)
> to behave correctly. And then we might as well avoid the string parsing
> and just do the "callback + pointer" in one struct (passed as pointer to
> compound literal), which also avoids the tricky "what to do about module
> unload versus unregistering of callbacks" etc.
Mathew Wilcox had the idea to introduce a structure:
struct printf_state {
char *buf;
char *end;
void *ptr;
};
Where *ptr would point to some data which should be printed,
same as wee pass to the %pbla now.
Then allow to implement:
char *my_func(struct printf_state *ps, void *ptr);
and use it as:
printk("%pX(%p)\n", my_func, ptr);
One problem here is type checking of the data passed via *ptr
but we already have the same problem now.
Another problem is how to make sure that the function is safe.
A solution might be to implement an API for appending characters,
strings, numbers, ... Similar to seq_buf() API.
AFAIK, the result was to actually use the existing seq_buf API
to format the string. AFAIK, it motivated:
+ commit 96928d9032a7c34f1 ("seq_buf: Add seq_buf_do_printk() helper")
and probably also
+ commit d0ed46b60396cfa7 ("tracing: Move readpos from seq_buf to trace_seq")
and also this one is pretty useful:
+ commit dcc4e5728eeaeda8 ("seq_buf: Introduce DECLARE_SEQ_BUF and
seq_buf_str()")
And it motivated:
+ commit dcc4e5728eeaeda84878ca0 ("seq_buf: Introduce
DECLARE_SEQ_BUF and seq_buf_str()")
Best Regards,
Petr
prev parent reply other threads:[~2024-02-28 9:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240215164055.30585-1-ville.syrjala@linux.intel.com>
[not found] ` <20240215164055.30585-2-ville.syrjala@linux.intel.com>
[not found] ` <ZdfApN1h97GTfL1t@intel.com>
2024-02-23 19:47 ` Ville Syrjälä
2024-02-26 14:57 ` Jani Nikula
2024-02-26 15:10 ` Andy Shevchenko
2024-02-26 15:35 ` Jani Nikula
2024-02-26 16:30 ` Andy Shevchenko
2024-02-26 16:35 ` Ville Syrjälä
2024-02-27 9:38 ` Rasmus Villemoes
2024-02-27 18:32 ` Ville Syrjälä
2024-02-28 8:32 ` Rasmus Villemoes
2024-02-28 9:55 ` Petr Mladek [this message]
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=Zd8CtrOmb8nfGBdl@alley \
--to=pmladek@suse.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=rodrigo.vivi@intel.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=ville.syrjala@linux.intel.com \
--cc=willy@infradead.org \
/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®