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=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 7931FC433DB for ; Tue, 2 Feb 2021 03:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4441464ECE for ; Tue, 2 Feb 2021 03:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231517AbhBBDwD (ORCPT ); Mon, 1 Feb 2021 22:52:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231423AbhBBDv7 (ORCPT ); Mon, 1 Feb 2021 22:51:59 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D959AC061573 for ; Mon, 1 Feb 2021 19:51:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=ULgMFWwk3TvS5KArsELEwceUudzpxXJ2XabGwJIlDsw=; b=1KJd+oZWsqE3ryTB2rApTwsozI cCXW5V1d7iCAc2pVHteHzrSBZnLuDOfm3Ek4+eV6euwXjkaO1Taei1Dh9JBHf07JUHtRm0sav3Ye0 r5RQQRUkPh8PN8mdwVY7htTUFhi19odDK0WUfg+opzYowC0d9U4+XxjEfPI03QFR7FdDZA8xsXutc YR8NheeSiBB9jD2UdZmRUHo83waguigTXs3T6TjUUlaSP/AEcZJNkhlfB4OrWdK16HLpJTx4N9pvc ICvuYh9EtT+9x5uhDowmxwYadNlS8Pb9ZZInrgPrCKVPhKVrnf4fYisiAK3XOhUMwvJCF32Zr4JVj w79OR71w==; Received: from [2601:1c0:6280:3f0::2a53] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6mie-0001Mo-1C; Tue, 02 Feb 2021 03:51:12 +0000 Subject: Re: [PATCH] arch_numa: fix common code printing of phys_addr_t To: Palmer Dabbelt Cc: linux-kernel@vger.kernel.org, lkp@intel.com, Atish Patra References: From: Randy Dunlap Message-ID: <0d6fb1da-6b14-7f54-3f4c-4697c88a14f7@infradead.org> Date: Mon, 1 Feb 2021 19:51:07 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/21 7:36 PM, Palmer Dabbelt wrote: > On Wed, 27 Jan 2021 19:55:33 PST (-0800), rdunlap@infradead.org wrote: >> Fix build warnings in the arch_numa common code: >> >> ../include/linux/kern_levels.h:5:18: warning: format '%Lx' expects argument of type 'long long unsigned int', but argument 3 has type 'phys_addr_t' {aka 'unsigned int'} [-Wformat=] >> ../drivers/base/arch_numa.c:360:56: note: format string is defined here >>   360 |    pr_warn("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n", >> ../drivers/base/arch_numa.c:435:39: note: format string is defined here >>   435 |  pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n", start, end - 1); >> >> Fixes: ae3c107cd8be ("numa: Move numa implementation to common code") >> Signed-off-by: Randy Dunlap >> Reported-by: kernel test robot >> Cc: Atish Patra >> Cc: Palmer Dabbelt >> --- >>  drivers/base/arch_numa.c |   13 +++++++------ >>  1 file changed, 7 insertions(+), 6 deletions(-) >> >> --- linux-next-20210125.orig/drivers/base/arch_numa.c >> +++ linux-next-20210125/drivers/base/arch_numa.c >> @@ -355,11 +355,12 @@ static int __init numa_register_nodes(vo >>      /* Check that valid nid is set to memblks */ >>      for_each_mem_region(mblk) { >>          int mblk_nid = memblock_get_region_node(mblk); >> +        phys_addr_t start = mblk->base; >> +        phys_addr_t end = mblk->base + mblk->size - 1; >> >>          if (mblk_nid == NUMA_NO_NODE || mblk_nid >= MAX_NUMNODES) { >> -            pr_warn("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n", >> -                mblk_nid, mblk->base, >> -                mblk->base + mblk->size - 1); >> +            pr_warn("Warning: invalid memblk node %d [mem %pap-%pap]\n", >> +                mblk_nid, &start, &end); >>              return -EINVAL; >>          } >>      } >> @@ -427,14 +428,14 @@ out_free_distance: >>  static int __init dummy_numa_init(void) >>  { >>      phys_addr_t start = memblock_start_of_DRAM(); >> -    phys_addr_t end = memblock_end_of_DRAM(); >> +    phys_addr_t end = memblock_end_of_DRAM() - 1; >>      int ret; >> >>      if (numa_off) >>          pr_info("NUMA disabled\n"); /* Forced off on command line. */ >> -    pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n", start, end - 1); >> +    pr_info("Faking a node at [mem %pap-%pap]\n", &start, &end); >> >> -    ret = numa_add_memblk(0, start, end); >> +    ret = numa_add_memblk(0, start, end + 1); >>      if (ret) { >>          pr_err("NUMA init failed\n"); >>          return ret; > > Thanks, this is on for-next.  Did you, by any chance, find %Lx documented > anywhere?  It's not ISO C and the GCC source code says it's a GNU extension, > but I couldn't find it in the documentation (or even where to add it, which I > guess is how I forgot to send my version fo the patch). 'man sprintf' says this: As a nonstandard extension, the GNU implementations treats ll and L as synonyms, so that one can, for example, write llg (as a synonym for the standards-compliant Lg) and Ld (as a synonym for the standards compli- ant lld). Such usage is nonportable. and linux/lib/vsprintf.c has some handling for it: if (qualifier == 'L') spec->type = FORMAT_TYPE_LONG_LONG; and case 'L': if (is_sign) *va_arg(args, long long *) = val.s; else *va_arg(args, unsigned long long *) = val.u; break; Does that help? -- ~Randy