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=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 C3D84C4332D for ; Fri, 20 Mar 2020 01:03:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 877B620740 for ; Fri, 20 Mar 2020 01:03:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="kLlN+Nnm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 877B620740 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 17F596B0003; Thu, 19 Mar 2020 21:03:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12F806B0006; Thu, 19 Mar 2020 21:03:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 044476B0007; Thu, 19 Mar 2020 21:03:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DE0676B0003 for ; Thu, 19 Mar 2020 21:03:43 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AC462180AD81A for ; Fri, 20 Mar 2020 01:03:43 +0000 (UTC) X-FDA: 76613943126.09.grape08_2078563898c28 X-HE-Tag: grape08_2078563898c28 X-Filterd-Recvd-Size: 5726 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Mar 2020 01:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To: Subject:Sender:Reply-To:Cc:Content-ID:Content-Description; bh=Ys84MSFThr+iceWVOVJ1ydyxTrqVWchEPrhB/TlXSx4=; b=kLlN+Nnmx9HvogqnfJbpvfqQI8 +MkKfXUUVy3e9kgGREXRcrq0vebzEsqrATfd/gUCaIn5TL4QIvw+g5oDaG3faiFTZwjmwW0lntlDY yJe18b9P/M7QPu7WPTull9l52/9WPB4Fq8pD3VXQzrBwTvwdS56asp6YVQRo+TzRYlDqsMjQiKacn ISf+sYy/t02OJjuS+Of2UZWkKujLE14J9guIWcgdpuqZu5khzDAcJfhDW5zfQh1VJl3Y7Wrql4Uv8 cqYW+KvV9y+dEH0qEy5OhjjmgKkjqpsYb8UDF/uTiOJyUdSqn/YXDxD9phBCoYC3xKKi3YDu3GPNQ 9ZKo9I4g==; Received: from [2601:1c0:6280:3f0::19c2] by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jF64X-0003Lf-B9; Fri, 20 Mar 2020 01:03:37 +0000 Subject: Re: [PATCH -next] mm/hugetlb.c: fix printk format warning for 32-bit phys_addr_t To: Joe Perches , Linux MM , Andrew Morton , LKML References: From: Randy Dunlap Message-ID: <58454a65-5022-7517-df65-7bf504cd1432@infradead.org> Date: Thu, 19 Mar 2020 18:03:35 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US 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 3/18/20 7:37 PM, Joe Perches wrote: > 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? I thought about where to put that and came up empty. > It's an odd pattern to grep. Maybe I missed some. It's probably not used much more than this. > $ 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", > > thanks. -- ~Randy