linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: Zhaoyang Huang <huangzhaoyang@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	 "zhaoyang.huang" <zhaoyang.huang@unisoc.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	 Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	 ke.wang@unisoc.com, Timur Tabi <timur@kernel.org>
Subject: Re: [PATCH] mm: fix printk format within cma
Date: Tue, 18 Apr 2023 13:24:06 +0800	[thread overview]
Message-ID: <875y9tvk3t.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <CAGWkznHHMSWpEJ1xjfgnA7k04AeO2hNpa=BRgCmKop0sJMTbsw@mail.gmail.com> (Zhaoyang Huang's message of "Tue, 18 Apr 2023 12:16:19 +0800")

Zhaoyang Huang <huangzhaoyang@gmail.com> writes:

> On Tue, Apr 18, 2023 at 11:38 AM Matthew Wilcox <willy@infradead.org> wrote:
>>
>> On Tue, Apr 18, 2023 at 11:33:09AM +0800, zhaoyang.huang wrote:
>> > cma and page pointer printed via %p are hash value which make debug to be hard.
>> > change them to %px.
>>
>> Why does printing the page pointer make any sense at all?  Surely the
>> PFN makes much more sense.
> either pfn or a correct page pointer makes sense for debugging, while
> page could be more safe than pfn which expose the paddr directly

You can specify "no_hash_pointers" in kernel command line to print
pointer value for debug.  IIUC, this take care of both security and
debuggability.

Best Regards,
Huang, Ying

>>
>> > [63321.482751] [c7] cma: cma_alloc(): memory range at 000000000b5e462c is busy, retrying
>> > [63321.482786] [c7] cma: cma_alloc(): memory range at 000000000f7d6fae is busy, retrying
>> > [63321.482823] [c7] cma: cma_alloc(): memory range at 00000000e653b59b is busy, retrying
>> > [63322.378890] [c7] cma: cma_release(page 00000000dd53cf48)
>> > [63322.378913] [c7] cma: cma_release(page 00000000315f703d)
>> > [63322.378925] [c7] cma: cma_release(page 00000000791e3a5f)
>> >
>> > Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
>> > ---
>> >  mm/cma.c | 6 +++---
>> >  1 file changed, 3 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/mm/cma.c b/mm/cma.c
>> > index 4a978e0..dfe9813 100644
>> > --- a/mm/cma.c
>> > +++ b/mm/cma.c
>> > @@ -435,7 +435,7 @@ struct page *cma_alloc(struct cma *cma, unsigned long count,
>> >       if (!cma || !cma->count || !cma->bitmap)
>> >               goto out;
>> >
>> > -     pr_debug("%s(cma %p, count %lu, align %d)\n", __func__, (void *)cma,
>> > +     pr_debug("%s(cma %px, count %lu, align %d)\n", __func__, (void *)cma,
>> >                count, align);
>> >
>> >       if (!count)
>> > @@ -534,7 +534,7 @@ bool cma_pages_valid(struct cma *cma, const struct page *pages,
>> >       pfn = page_to_pfn(pages);
>> >
>> >       if (pfn < cma->base_pfn || pfn >= cma->base_pfn + cma->count) {
>> > -             pr_debug("%s(page %p, count %lu)\n", __func__,
>> > +             pr_debug("%s(page %px, count %lu)\n", __func__,
>> >                                               (void *)pages, count);
>> >               return false;
>> >       }
>> > @@ -560,7 +560,7 @@ bool cma_release(struct cma *cma, const struct page *pages,
>> >       if (!cma_pages_valid(cma, pages, count))
>> >               return false;
>> >
>> > -     pr_debug("%s(page %p, count %lu)\n", __func__, (void *)pages, count);
>> > +     pr_debug("%s(page %px, count %lu)\n", __func__, (void *)pages, count);
>> >
>> >       pfn = page_to_pfn(pages);
>> >
>> > --
>> > 1.9.1
>> >
>> >


  reply	other threads:[~2023-04-18  5:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  3:33 zhaoyang.huang
2023-04-18  3:38 ` Matthew Wilcox
2023-04-18  4:16   ` Zhaoyang Huang
2023-04-18  5:24     ` Huang, Ying [this message]
2023-04-18 19:33   ` Andrew Morton
2023-04-28 14:35     ` Matthew Wilcox

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=875y9tvk3t.fsf@yhuang6-desk2.ccr.corp.intel.com \
    --to=ying.huang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=huangzhaoyang@gmail.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=ke.wang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=timur@kernel.org \
    --cc=willy@infradead.org \
    --cc=zhaoyang.huang@unisoc.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