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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 9F7FDC4332B for ; Thu, 19 Mar 2020 02:39:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 61ABC20768 for ; Thu, 19 Mar 2020 02:39:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61ABC20768 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D85926B0005; Wed, 18 Mar 2020 22:39:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D35C96B0006; Wed, 18 Mar 2020 22:39:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFCF16B0008; Wed, 18 Mar 2020 22:39:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id A850D6B0005 for ; Wed, 18 Mar 2020 22:39:51 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 436A0181AEF10 for ; Thu, 19 Mar 2020 02:39:51 +0000 (UTC) X-FDA: 76610556582.15.level16_55ffa773a9f2b X-HE-Tag: level16_55ffa773a9f2b X-Filterd-Recvd-Size: 5724 Received: from smtprelay.hostedemail.com (smtprelay0105.hostedemail.com [216.40.44.105]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Mar 2020 02:39:50 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id A8FEF837F253; Thu, 19 Mar 2020 02:39:50 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: meal06_55c420e8b4f2c X-Filterd-Recvd-Size: 4509 Received: from XPS-9350 (unknown [172.58.27.183]) (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA; Thu, 19 Mar 2020 02:39:49 +0000 (UTC) Message-ID: Subject: Re: [PATCH -next] mm/hugetlb.c: fix printk format warning for 32-bit phys_addr_t From: Joe Perches To: Randy Dunlap , Linux MM , Andrew Morton , LKML Date: Wed, 18 Mar 2020 19:37:58 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 Wed, 2020-03-18 at 19:11 -0700, Randy Dunlap wrote: > On 3/18/20 7:04 PM, Joe Perches wrote: > > On Wed, 2020-03-18 at 14:33 -0700, Randy Dunlap wrote: > > > From: Randy Dunlap > > > > > > Fix printk format warnings when phys_addr_t is 32 bits, i.e., > > > CONFIG_PHYS_ADDR_T_64BIT is not set/enabled. > > [] > > > ../mm/hugetlb.c:5472:73: note: format string is defined here > > > pr_warn("hugetlb_cma: reservation failed: err %d, node %d, [%llu, %llu)", > > > ~~~^ > > [] > > > --- linux-next-20200318.orig/mm/hugetlb.c > > > +++ linux-next-20200318/mm/hugetlb.c > > > @@ -5469,8 +5469,10 @@ void __init hugetlb_cma_reserve(int orde > > > 0, false, > > > "hugetlb", &hugetlb_cma[nid]); > > > if (res) { > > > - pr_warn("hugetlb_cma: reservation failed: err %d, node %d, [%llu, %llu)", > > > - res, nid, PFN_PHYS(min_pfn), PFN_PHYS(max_pfn)); > > > + phys_addr_t begpa = PFN_PHYS(min_pfn); > > > + phys_addr_t endpa = PFN_PHYS(max_pfn); > > > + pr_warn("hugetlb_cma: reservation failed: err %d, node %d, [%pap, %pap)", > > > + res, nid, &begpa, &endpa); > > > > You might correct the odd use of an open bracket > > then close parenthesis and add a new line too > > Definitely needs a newline char. > > I'm fairly sure that the [begin, end) notation is done on purpose, meaning > is included in the range and is not included in the range. OK, that seems a pretty obscure and not obvious use of interval notation, at least to me. (18 uses treewide ?) Maybe it could be documented somewhere? It's an odd pattern to grep. Maybe I missed some. $ git grep -P '".*[\[\{]\s*%\d*[ldux]+\s*[/:,\.\-]?\s*%\d*[ldux]+\).*"' arch/x86/kernel/alternative.c: DUMP_BYTES(instr, a->instrlen, "%px: [%d:%d) optimized NOPs: ", drivers/clk/qcom/clk-alpha-pll.c: pr_err("%s: Rounded rate %lu not within range [%lu, %lu)\n", fs/ext4/extents_status.c: printk(KERN_DEBUG " [%u/%u) %llu %x", fs/ext4/extents_status.c: es_debug("%u cached by [%u/%u) %llu %x\n", fs/ext4/extents_status.c: es_debug("add [%u/%u) %llu %x to extent status tree of inode %lu\n", fs/ext4/extents_status.c: es_debug("%u cached by [%u/%u)\n", fs/ext4/extents_status.c: es_debug("remove [%u/%u) from extent status tree of inode %lu\n", fs/nilfs2/cpfile.c: "cannot delete checkpoints: invalid range [%llu, %llu)", fs/nilfs2/dat.c: "%s: invalid vblocknr = %llu, [%llu, %llu)", include/trace/events/ext4.h: TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s", include/trace/events/ext4.h: TP_printk("dev %d,%d ino %lu es [%lld/%lld)", include/trace/events/ext4.h: TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s", include/trace/events/ext4.h: TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s", include/trace/events/ext4.h: TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s " mm/hugetlb.c: pr_warn("hugetlb_cma: reservation failed: err %d, node %d, [%llu, %llu)", mm/kasan/report.c: pr_err(" [%lu, %lu) '%s'", offset, offset + size, token); mm/page_alloc.c: pr_info_ratelimited("%s: [%lx, %lx) PFNs busy\n", tools/testing/selftests/kvm/demand_paging_test.c: PER_VCPU_DEBUG("Added VCPU %d with test mem gpa [%lx, %lx)\n",