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=-8.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 33C79C18E5A for ; Wed, 11 Mar 2020 08:01:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E9A9C205C9 for ; Wed, 11 Mar 2020 08:01:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ezVsxqFO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9A9C205C9 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 6F6866B0003; Wed, 11 Mar 2020 04:01:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A6996B0006; Wed, 11 Mar 2020 04:01:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 597056B0007; Wed, 11 Mar 2020 04:01:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 3DAC16B0003 for ; Wed, 11 Mar 2020 04:01:47 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BD641181AEF1A for ; Wed, 11 Mar 2020 08:01:46 +0000 (UTC) X-FDA: 76582337412.01.cup17_66cfbdf771163 X-HE-Tag: cup17_66cfbdf771163 X-Filterd-Recvd-Size: 5040 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Mar 2020 08:01:46 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id i13so858113pfe.3 for ; Wed, 11 Mar 2020 01:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=uiQdivkiv6IPCawSjgtjj8tGPXbqy5m7LgBTibRfPZM=; b=ezVsxqFOJ8TxfDj0Uz1HsP9bfP85lQA4os0YXTRK5j0/t/GSxeg/zjI9NusIN/2b+D SKCrIrUYdlT/cG6uDjIMPb0rKOGFYW1P7TLKMeyt3bP7MYUEP0x5quddjt72biNVgVM4 8EPzapij3pOnjHNB0F5rKGw8vv5MjSQ/In+yHh/o0h/NTgMzMFIJEr+px1q5XcAxOuvA LUNTculMM3aD6LrMvkwk2Lck/iM/NxN7Wh3KrAyHBSl7l95a4C2huBurD6oP/Gxwd1TY 3gLgQAdDiTW16DeGnSt8bmLq525MJ/51ZKfkIpq7zMHgG2g7GfB6HcQXJEtxZFA5xUW5 fhqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=uiQdivkiv6IPCawSjgtjj8tGPXbqy5m7LgBTibRfPZM=; b=YbWO30rNK9TkeSRYkIA8aGJyGxsradm8K9t1S5gUsLhiB0NhtCs4LWTZtQQa+DL0Wd N2E5CW2vXmdh3IqvWoGPWLU2Iv8em8WpCgUESvV/0he2y3liVYAsiR5GUCkNuSAztG9R dZmWRDJnnscyEsLQH7iN46XDIVrA6a/0gMFx1BGghrP+qgOtdDhR+sqyT0TDStDZuMXI /GwltWAadAGLhVfRLoi5UM2CO6ser5c5J2miqTq5l0juoipAAEcMNONUYCYzLo7gal17 ckJgqgmbilW0UA/GTOfL4UdLM7M42Rf/acT8ruBl6kUJo1kjXOP8OBUIyiceNZnkZl85 Jmxw== X-Gm-Message-State: ANhLgQ02kKgvHp1Zdc9R3kbBhbuRMsHhfrM3ErjcpN+ReEypHP4mnAcg gMUfL2RRsuxe7DIVjtC4VKA= X-Google-Smtp-Source: ADFU+vvG4TdzYnleewbvx3CCJDuTQmVsChvdEmv0swcVEZ3mv+FIDf2bkqkmgp0ySRKbMXSEMXS/ag== X-Received: by 2002:a62:3854:: with SMTP id f81mr1642275pfa.81.1583913705500; Wed, 11 Mar 2020 01:01:45 -0700 (PDT) Received: from localhost ([43.224.245.179]) by smtp.gmail.com with ESMTPSA id 23sm50454121pfh.28.2020.03.11.01.01.44 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 11 Mar 2020 01:01:44 -0700 (PDT) Date: Wed, 11 Mar 2020 16:01:42 +0800 From: chenqiwu To: John Hubbard Cc: akpm@linux-foundation.org, linux-mm@kvack.org, chenqiwu Subject: Re: [RESEND PATCH] mm/sparsemem: use wrapped macros instead of open-coding Message-ID: <20200311080142.GA30917@cqw-OptiPlex-7050> References: <1583489966-16390-1-git-send-email-qiwuchen55@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Content-Transfer-Encoding: quoted-printable 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 Tue, Mar 10, 2020 at 07:10:10PM -0700, John Hubbard wrote: > On 3/6/20 2:19 AM, qiwuchen55@gmail.com wrote: > > From: chenqiwu > >=20 > > Use wrapped macros instead of open-coding for better code > > readability. > >=20 > > Signed-off-by: chenqiwu >=20 >=20 > This breaks my x86 (64-bit) build: >=20 > mm/sparse.c: In function =E2=80=98check_usemap_section_nr=E2=80=99: > mm/sparse.c:389:33: error: implicit declaration of function =E2=80=98vi= rt_to_pfn=E2=80=99; did you mean =E2=80=98virt_to_phys=E2=80=99? [-Werror= =3Dimplicit-function-declaration] > 389 | usemap_snr =3D pfn_to_section_nr(virt_to_pfn(usage)); > | ^~~~~~~~~~~ > | virt_to_phys >=20 >=20 > ...and I think the reason is that the arch/x86/include/asm/page.h does = not > have virt_to_pfn(). For that reason, I'm concerned that the following f= ix,=20 > which fixes up x86, may not completely correct for the patch. >=20 > Here's a compile-tested (only, and only on x86 64-bit) fix: >=20 > diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h > index 7555b48803a8..982bc76bf13c 100644 > --- a/arch/x86/include/asm/page.h > +++ b/arch/x86/include/asm/page.h > @@ -62,6 +62,9 @@ static inline void copy_user_page(void *to, void *fro= m, unsigned long vaddr, > #define __boot_va(x) __va(x) > #define __boot_pa(x) __pa(x) > =20 > +#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) > +#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) > + > /* > * virt_to_page(kaddr) returns a valid pointer if and only if > * virt_addr_valid(kaddr) returns true. >=20 >=20 > thanks, > --=20 > John Hubbard > NVIDIA Hi John, I tested this patch only on arm64 build, not sure if any other build breakings. But I think any architecture is worth to support virt_to_pfn() API. Could you please send your compile-tested patch to x86 upstream? Thanks Qiwu