From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Petr Mladek <pmladek@suse.com>, Pedro Falcato <pfalcato@suse.de>
Cc: David Hildenbrand <david@redhat.com>,
linux-mm@kvack.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Jonathan Corbet <corbet@lwn.net>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [RFC 1/2] lib/vsprintf: Add support for pte_t
Date: Fri, 20 Jun 2025 11:30:47 +0530 [thread overview]
Message-ID: <9f3fdc4f-2f44-4a3b-9b8b-425003b0be99@arm.com> (raw)
In-Reply-To: <aFQLtrSGxcscq9No@pathway.suse.cz>
On 19/06/25 6:38 PM, Petr Mladek wrote:
> On Wed 2025-06-18 19:16:00, Pedro Falcato wrote:
>> On Wed, Jun 18, 2025 at 10:44:20AM +0200, David Hildenbrand wrote:
>>> On 18.06.25 10:37, Anshuman Khandual wrote:
>>>>
>>>>
>>>> On 18/06/25 1:48 PM, David Hildenbrand wrote:
>>>>> On 18.06.25 06:12, Anshuman Khandual wrote:
>>>>>> Add a new format for printing page table entries.
>>>>>>
>>>>>> Cc: Petr Mladek <pmladek@suse.com>
>>>>>> Cc: Steven Rostedt <rostedt@goodmis.org>
>>>>>> Cc: Jonathan Corbet <corbet@lwn.net>
>>>>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>>>>> Cc: David Hildenbrand <david@redhat.com>
>>>>>> Cc: linux-doc@vger.kernel.org
>>>>>> Cc: linux-kernel@vger.kernel.org
>>>>>> Cc: linux-mm@kvack.org
>>>>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>>>>> ---
>>>>>> Documentation/core-api/printk-formats.rst | 14 ++++++++++++++
>>>>>> lib/vsprintf.c | 20 ++++++++++++++++++++
>>>>>> mm/memory.c | 5 ++---
>>>>>> scripts/checkpatch.pl | 2 +-
>>>>>> 4 files changed, 37 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
>>>>>> index 4b7f3646ec6ce..75a110b059ee1 100644
>>>>>> --- a/Documentation/core-api/printk-formats.rst
>>>>>> +++ b/Documentation/core-api/printk-formats.rst
>>>>>> @@ -689,6 +689,20 @@ Rust
>>>>>> Only intended to be used from Rust code to format ``core::fmt::Arguments``.
>>>>>> Do *not* use it from C.
>>>>>> +Page Table Entry
>>>>>> +----------------
>>>>>> +
>>>>>> +::
>>>>>> + %ppte
>>>>>> +
>>>>>> +Print standard page table entry pte_t.
>>>>>> +
>>>>>> +Passed by reference.
>>>>>
>>>>> Curious, why the decision to pass by reference?
>>>>
>>>> Just to make this via %p<> based address mechanism. But wondering
>>>> will it be better for the pte to be represented via value instead
>>>> of reference ?
>>>
>>> We commonly pass ptes to functions through value, not reference, that's why
>>> I am asking.
>>
>>
>> All printf/printk extensions in the kernel follow %p<some letters> and use
>> pointers because %p takes pointers, so it lets us use -Wformat with no issues.
>>
>> So yes, taking a pte_t * is required.
>
> Correct. But the pointer is usually needed because the %pxx format
> need to access a structure.
Right.
>
> Passing a pointer is another potential source of errors. I mean that
> the callers might pass an invalid pointer by mistake...
Agreed - could be a source of error when not used properly.
>
> Another aspect is performance. It is likely not a big deal for classic
> printk() which is a slow path. But trace_printk() tries to optimize
> the speed by deferred formatting where possible, see vbin_printf()
> and bstr_printf().
>
> I think that this is not a blocker for this patchset. But you should
> know that using %pxx has a cost.
Got it - thanks for the explanation.
next prev parent reply other threads:[~2025-06-20 6:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 4:12 [RFC 0/2] " Anshuman Khandual
2025-06-18 4:12 ` [RFC 1/2] " Anshuman Khandual
2025-06-18 8:18 ` David Hildenbrand
2025-06-18 8:37 ` Anshuman Khandual
2025-06-18 8:44 ` David Hildenbrand
2025-06-18 18:16 ` Pedro Falcato
2025-06-19 13:08 ` Petr Mladek
2025-06-20 6:00 ` Anshuman Khandual [this message]
2025-06-18 8:19 ` David Hildenbrand
2025-06-18 8:33 ` Anshuman Khandual
2025-06-18 8:43 ` David Hildenbrand
2025-06-20 6:30 ` Anshuman Khandual
2025-06-18 17:46 ` Andy Shevchenko
2025-06-19 9:35 ` Anshuman Khandual
2025-06-19 12:00 ` Andy Shevchenko
2025-06-20 6:53 ` Anshuman Khandual
2025-06-21 19:14 ` Andy Shevchenko
2025-06-19 13:12 ` Petr Mladek
2025-06-20 6:38 ` Anshuman Khandual
2025-06-18 18:19 ` Pedro Falcato
2025-06-19 9:53 ` Anshuman Khandual
2025-06-19 13:26 ` Matthew Wilcox
2025-06-20 8:12 ` Anshuman Khandual
2025-06-24 13:11 ` Matthew Wilcox
2025-06-24 14:23 ` Steven Rostedt
2025-06-19 14:01 ` Petr Mladek
2025-06-20 8:02 ` Anshuman Khandual
2025-06-24 10:48 ` Petr Mladek
2025-06-24 13:09 ` Andy Shevchenko
2025-06-18 4:12 ` [RFC 2/2] kunit: printf: Add test case " Anshuman Khandual
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=9f3fdc4f-2f44-4a3b-9b8b-425003b0be99@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pfalcato@suse.de \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.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®