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=-13.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,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 300FCC2D0A3 for ; Mon, 9 Nov 2020 06:02:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 844412065C for ; Mon, 9 Nov 2020 06:02:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 844412065C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8272B6B0036; Mon, 9 Nov 2020 01:02:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D76C6B005D; Mon, 9 Nov 2020 01:02:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F0206B0068; Mon, 9 Nov 2020 01:02:00 -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 3F5316B0036 for ; Mon, 9 Nov 2020 01:02:00 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D5D27362B for ; Mon, 9 Nov 2020 06:01:59 +0000 (UTC) X-FDA: 77463833958.06.paint22_1114567272ea Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id B676B1003A951 for ; Mon, 9 Nov 2020 06:01:59 +0000 (UTC) X-HE-Tag: paint22_1114567272ea X-Filterd-Recvd-Size: 5253 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Mon, 9 Nov 2020 06:01:59 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B6683101E; Sun, 8 Nov 2020 22:01:56 -0800 (PST) Received: from [10.163.78.250] (unknown [10.163.78.250]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6B3093F6CF; Sun, 8 Nov 2020 22:01:54 -0800 (PST) Subject: Re: [linux-next:master] BUILD REGRESSION 0a6f624a86e766a27d23cbb73c23be62231d10ff To: Andrew Morton Cc: kernel test robot , Linux Memory Management List , linux-arm-kernel@lists.arm.linux.org.uk, Russell King , Catalin Marinas , Linus Walleij , Ard Biesheuvel References: <5fa49698.Vu2O3r+dU20UoEJ+%lkp@intel.com> <20201106210721.42351b86042b54d7d2c280e5@linux-foundation.org> <30c06c32-e3dd-4ce9-606b-d5731c0ae27c@arm.com> <20201108185522.a581d330cd4a9b25f5cbd339@linux-foundation.org> From: Anshuman Khandual Message-ID: <16c1cfde-525c-1303-e1f6-d8d7fdd81cd9@arm.com> Date: Mon, 9 Nov 2020 11:31:51 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201108185522.a581d330cd4a9b25f5cbd339@linux-foundation.org> 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 11/9/20 8:25 AM, Andrew Morton wrote: > On Mon, 9 Nov 2020 08:20:05 +0530 Anshuman Khandual wrote: > >> >> >> On 11/7/20 10:37 AM, Andrew Morton wrote: >>> On Fri, 06 Nov 2020 08:19:36 +0800 kernel test robot wrote: >>> >>>> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master >>>> branch HEAD: 0a6f624a86e766a27d23cbb73c23be62231d10ff Add linux-next specific files for 20201105 >>>> >>>> Error/Warning reports: >>>> >>>> https://lore.kernel.org/linux-mm/202010281624.9m2gZw45-lkp@intel.com >>>> https://lore.kernel.org/linux-mm/202010290238.M1tDrV8p-lkp@intel.com >>>> https://lore.kernel.org/linux-mm/202010291054.WEZO3olr-lkp@intel.com >>>> https://lore.kernel.org/linux-mm/202011020749.5XQ3Hfzc-lkp@intel.com >>>> >>>> ... >>>> >>>> mm/kasan/init.c:318:9: warning: variable 'pud' set but not used [-Wunused-but-set-variable] >>>> >>> >>> This is because mm/kasan/init.c does >>> >>> static void kasan_free_pud(pud_t *pud_start, p4d_t *p4d) >>> { >>> pud_t *pud; >>> int i; >>> >>> for (i = 0; i < PTRS_PER_PUD; i++) { >>> pud = pud_start + i; >>> if (!pud_none(*pud)) >>> return; >>> } >>> >>> pud_free(&init_mm, (pud_t *)page_to_virt(p4d_page(*p4d))); >>> p4d_clear(p4d); >>> } >>> >>> but arch/arm/include/asm/pgtable-2level.h does >>> >>> #define pud_none(pud) (0) >>> >>> The solution here is for the arm implementation to reference `pud'. >>> Typically this is done via the use of an empty static inline C function >>> rather than a macro. But really all of these >>> >>> #define pud_none(pud) (0) >>> #define pud_bad(pud) (0) >>> #define pud_present(pud) (1) >>> #define pud_clear(pudp) do { } while (0) >>> #define set_pud(pud,pudp) do { } while (0) >>> >>> should be thus converted. >>> >>> Could someone in arm world please attend to this? >> >> + Ard Biesheuvel >> + Linus Walleij >> >> There were some earlier discussions to solve this in a different way. >> >> https://lore.kernel.org/linux-mm/CACRpkdbAXCMTW--BmVs8SQ_u5baaeUob+U57E=4=CrMxWtMO2g@mail.gmail.com/ >> >> with a subsequent follow up patch. >> >> https://lore.kernel.org/linux-arm-kernel/20201106085157.11211-1-linus.walleij@linaro.org/ > > Yes, but why? macros-pretending-to-be-functions just keep on causing > problems and they're so unnecessary. Why not just write functions in > the first place?? Did anyone try implementing that? Just build tested this. Observed that set_pud()'s arguments here seems to have been reversed. If this looks okay, will send out. diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h index 3502c2f..9d4f5ee 100644 --- a/arch/arm/include/asm/pgtable-2level.h +++ b/arch/arm/include/asm/pgtable-2level.h @@ -177,11 +177,28 @@ * the pud: the pud entry is never bad, always exists, and can't be set or * cleared. */ -#define pud_none(pud) (0) -#define pud_bad(pud) (0) -#define pud_present(pud) (1) -#define pud_clear(pudp) do { } while (0) -#define set_pud(pud,pudp) do { } while (0) +static inline int pud_none(pud_t pud) +{ + return 0; +} + +static inline int pud_bad(pud_t pud) +{ + return 0; +} + +static inline int pud_present(pud_t pud) +{ + return 1; +} + +static inline void pud_clear(pud_t *pudp) +{ +} + +static inline void set_pud(pud_t *pudp, pud_t pud) +{ +}