From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96ED7C433E0 for ; Tue, 23 Feb 2021 01:11:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0241E64E4A for ; Tue, 23 Feb 2021 01:11:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0241E64E4A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4900F6B0005; Mon, 22 Feb 2021 20:11:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4400A6B006C; Mon, 22 Feb 2021 20:11:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32E956B006E; Mon, 22 Feb 2021 20:11:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 1B1736B0005 for ; Mon, 22 Feb 2021 20:11:27 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CA59C181AC9C6 for ; Tue, 23 Feb 2021 01:11:26 +0000 (UTC) X-FDA: 77847754572.12.36C8086 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by imf19.hostedemail.com (Postfix) with ESMTP id 19AE590009E9 for ; Tue, 23 Feb 2021 01:11:22 +0000 (UTC) Received: by mail-io1-f43.google.com with SMTP id f6so15367322iop.11 for ; Mon, 22 Feb 2021 17:11:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pxy3fWqnHXSmeJ/dQM3CI4wtPt6Zw1lUR2mc3ToJ5/U=; b=M8F6iblXQybOLnVOmmxssZ95gs5WM3Mkswy2mvjKceLanmgSFTpdoTLL9rzFP/zgn/ koxPEgzm+G/MloTKcpih+xM/3SAVmV2lPBjsKnIn77ZUdkS017idJOWt6/akFMBhk5KE xAWLjPdhFiQpN3/PfUxjqrm8hRE1qPBnzOO4iAc1gh+p7mSUWt58Uw5sCJ5YYS/UklEk F/iEZsp8OFkkSpuZB37NA/Y7Z5ECBrw+KxLXtQgq3eZeEIDoGGabhdrhlau1rbu1809s pZccHcVybvPwdRx7+Uz3U5KRHPkDb/dV9H3I788/iAmwGcbwRxOMsWmx1RFk+p7NPwbI acng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pxy3fWqnHXSmeJ/dQM3CI4wtPt6Zw1lUR2mc3ToJ5/U=; b=sjb7JJEacYNBobsNJV44hPOWwv1hhWeb0G8aZsh5uCVsc5YmYjEOSfL5yA3sJiP6FL VNkgoSs4FPW9WFZY99CcHJ/FpV0hH9e46YkdmdN5EHKksZ6vbh0O3+0MJ2swvhHSbfZR YnB6QKxX/8CITM6jGD396tQu1520C9FLUR4OyU/mPL1lNy9xeFtflnnCXatbsV5n33Di uRVxi6IMMOAwk0POZ/sUye+hqK/WAhlAOoMLLmx04Wl2h9CjhIvnpcbzcu9AGeOileZh XnwICSr5Ela8KsJ1cdoK3HtYm+XzSXRX5G0TA/Cz5zZ6PdJuAa9mK5lEqyV35Y9N5rfh Z12A== X-Gm-Message-State: AOAM533AcD89DYro+k5n8nr/937GoVw17dEtNxvA4lWK/CxMG7NVuO+O u/dQxcwPPn0NPUhLIokiN+e6l+VaOJ/xmWkRbgQ= X-Google-Smtp-Source: ABdhPJzPK/u7Ujb2x3bbp+XmeDgOyG4RhdiosVYeJg+U+4wRS+v45yBrXadC3+gmtPi82gnqgG8KdB1pUaeG671I3Kw= X-Received: by 2002:a5d:9510:: with SMTP id d16mr17604451iom.81.1614042685855; Mon, 22 Feb 2021 17:11:25 -0800 (PST) MIME-Version: 1.0 References: <20210215155141.47432-1-laoar.shao@gmail.com> <20210215155141.47432-4-laoar.shao@gmail.com> In-Reply-To: From: Yafang Shao Date: Tue, 23 Feb 2021 09:10:49 +0800 Message-ID: Subject: Re: [PATCH v5 3/3] vsprintf: dump full information of page flags in pGp To: Petr Mladek Cc: Matthew Wilcox , Andy Shevchenko , David Hildenbrand , Miaohe Lin , Vlastimil Babka , Christoph Lameter , penberg@kernel.org, David Rientjes , iamjoonsoo.kim@lge.com, Andrew Morton , Steven Rostedt , Sergey Senozhatsky , Joe Perches , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 19AE590009E9 X-Stat-Signature: prqq7br4ehyym493spdherz1kafwpop7 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mail-io1-f43.google.com; client-ip=209.85.166.43 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614042682-532450 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 22, 2021 at 8:38 PM Petr Mladek wrote: > > Hello, > > first, I am sorry for the late reply. I have marked the thread as > proceed by mistake last week... > > > On Mon 2021-02-15 23:51:41, Yafang Shao wrote: > > Currently the pGp only shows the names of page flags, rather than > > the full information including section, node, zone, last cpupid and > > kasan tag. While it is not easy to parse these information manually > > because there're so many flavors. Let's interpret them in pGp as well. > > > > To be compitable with the existed format of pGp, the new introduced ones > > also use '|' as the separator, then the user tools parsing pGp won't > > need to make change, suggested by Matthew. The new information is > > tracked onto the end of the existed one. > > > > One example of the output in mm/slub.c as follows, > > - Before the patch, > > [ 6343.396602] Slab 0x000000004382e02b objects=33 used=3 fp=0x000000009ae06ffc flags=0x17ffffc0010200(slab|head) > > > > - After the patch, > > [ 8448.272530] Slab 0x0000000090797883 objects=33 used=3 fp=0x00000000790f1c26 flags=0x17ffffc0010200(slab|head|node=0|zone=2|lastcpupid=0x1fffff) > > > > The documentation and test cases are also updated. The output of the > > test cases as follows, > > [11585.830272] test_printf: loaded. > > [11585.830454] test_printf: all 388 tests passed > > [11585.831401] test_printf: unloaded. > > > > --- a/lib/vsprintf.c > > +++ b/lib/vsprintf.c > > +static > > +char *format_page_flags(char *buf, char *end, unsigned long flags) > > +{ > > + unsigned long main_flags = flags & (BIT(NR_PAGEFLAGS) - 1); > > + bool append = false; > > + int i; > > + > > + /* Page flags from the main area. */ > > + if (main_flags) { > > + buf = format_flags(buf, end, main_flags, pageflag_names); > > + append = true; > > + } > > + > > + /* Page flags from the fields area */ > > + for (i = 0; i < ARRAY_SIZE(pff); i++) { > > + /* Skip undefined fields. */ > > + if (!pff[i].width) > > + continue; > > + > > + /* Format: Flag Name + '=' (equals sign) + Number + '|' (separator) */ > > + if (append) { > > + if (buf < end) > > + *buf = '|'; > > + buf++; > > + } > > + > > + buf = string(buf, end, pff[i].name, *pff[i].spec); > > I have found one more small issue. > > The purpose of the flag-specific printk_spec is to define the format > how the value is printed. The name of the flag should be printed > using default_str_spec. > > It works because the string is printed as-is with both > default_dec_spec and default_flag_spec. But it would be better > to use the string format. > Thanks for the explanation. > > + if (buf < end) > > + *buf = '='; > > + buf++; > > + buf = number(buf, end, (flags >> pff[i].shift) & pff[i].mask, > > + *pff[i].spec); > > + > > + append = true; > > + } > > + > > + return buf; > > +} > > Otherwise, the patch looks to me. The issue is cosmetic and might be > fixed either by re-spinning just this patch or by a followup patch. I will send a separate followup patch. > Either way, feel free to use: > > Reviewed-by: Petr Mladek > Thanks > Another question where to push this change. It is pity the we > finalized it in the middle of the merge window. It has to spend > at least few days in linux-next. > > I would like to hear from Andy before I push it into linux-next. > There is still theoretical chance to get it into 5.12 when Linus > prolongs the merge window by one week. it has been delayed by > a long lasting power outage. > > Best Regards, > Petr -- Thanks Yafang