Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp932858pxb; Fri, 22 Apr 2022 14:42:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXhvfgKdGf1/mTsXU9gfiZuehmzuUUqbIHbuJQ9YvDsj9EBlWQRpqv8mzWDYCThvW/uP5n X-Received: by 2002:a63:cd0d:0:b0:39c:d48c:67cc with SMTP id i13-20020a63cd0d000000b0039cd48c67ccmr5605845pgg.606.1650663720087; Fri, 22 Apr 2022 14:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650663720; cv=none; d=google.com; s=arc-20160816; b=u0uucwZssWwLAdXK0F16/cnACawZKW4LkcQ5k0bm1v5cX+Y3u+lnWES3+m+Ng2oP57 B6z3XxHyIlDnPnDc7/axJ+49dxUCZz0vOPf6UAZcgOmsKYZwS8jR+zcD3hT+TmgjU06o cBGLP/9Bym53J6DGbJfBM0tB0BVkbIR1dQugIiL//PTL2XAzQ/ZkCSYqzoacY/4ET24u w0jno05gFZSR0yvNnicyoTeQ/JP6tAOe61wHf4mmr3gnot+9FDmShKGymE8dwgK40hDg InuJjejDEJhghcS41q1+1XAz8xfbPGlmNfhomTwykvf4CsU4hb0Z8kxGi3qTkJYQeclH NGIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=Nk2NSwsu8i6rTINc46A+r9NE/5YNi7JyHO9FbngN7p8=; b=BzWCSQn/JVgT5NeXnRTgjdjYnHzJP5niVkO/WAqsMzmz/cNTWJoaiLBDKPzpn8m633 eoHPbBmirjFdUuRnbOG+idm1D/drdrN4OTaZ6Tv2hnGRzR3P7oL0YIq5lE2vbzJajAJ8 QuL4VXJSb8ittAifTB3CZQRRbueoQWRHf1QXty/j/3N8cOBYtzDcBdluoFszVB/02ohl DE+NE+XNe/lybDEDvzSWKs1Wa6JjBQEfdVM4K3h0VV8N5IDnXUaKt4QZ1JUzoa9dnjFI hpMiwMXfGo6m2X/gbpEUcpZcwRRqBBBQxIzBO2GWJ2SvKhGeyHe1XPin6W7ZEXUSbVkg 8kzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=TYs6nRRw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id nu12-20020a17090b1b0c00b001cb4dcc6179si6846128pjb.1.2022.04.22.14.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:42:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=TYs6nRRw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 989B2175DE7; Fri, 22 Apr 2022 12:49:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380158AbiDTSv7 (ORCPT + 99 others); Wed, 20 Apr 2022 14:51:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345869AbiDTSv5 (ORCPT ); Wed, 20 Apr 2022 14:51:57 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A3E144A06 for ; Wed, 20 Apr 2022 11:49:10 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id n33-20020a17090a5aa400b001d28f5ee3f9so2860874pji.4 for ; Wed, 20 Apr 2022 11:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=Nk2NSwsu8i6rTINc46A+r9NE/5YNi7JyHO9FbngN7p8=; b=TYs6nRRwUQOFf0gtOjWDh1j18vGSYUtK/5FrQeZVyfc+LVCQdKOhbVjQZZHNUsscec GNgdiEnj4ZM4kRz7ic/Mul+yJsrVlfaOlC4WQKe6QJtGkXCpWSlpSlLeXhOo44sehCZj 5zmAUgRw3YmXiB9ErQ5mzGNIBs/39+GtIY4gL3nMYDeExzMHPqq8rvAcU6RbK5le3vAg AlrUwjB5dfhamDuwH6PjpxKTkmH3/+SIo6HuuJrQ5k/pLSyczcEChBfZnzVNh8MlDH23 3u/2w+5bV/Ff9W1CVHbLsENkaR69HAvIXR1yC4dKEli4yiyIkGeEkf3FouQDwP7zixfV bTEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=Nk2NSwsu8i6rTINc46A+r9NE/5YNi7JyHO9FbngN7p8=; b=f6/uI5quRm7ubLN+SD39zD0rJahDmspgSeSGuAXtvZ+GLBPGsIhTzp3k1z8p1ezB59 x1/5vjIaiJa1Kv84UjG4Yi79ZB9EYQBq1g6Ox2rW10/NcUNxvsa/DSXpXsntCnX95pOc M3VXM2lSQTX3CQ4WMl7Bd/NDnJ/XsyTOxiKmBlU7O24GI6Q2PF3TsV+6MF//6rb3qT0f HILKV8NiKI0RpoO2SsdYWCYwTzFX/LTzqywe+wNDfkSxncu+o3JHeB6k9HeTQ4ew6mMc 6BfKe4P1pBpWUzdqzax4hLX4ZxTbww0moFytRVUAiz7+uWPSYaMEqfkEkgZsGcATfo3/ 2I5w== X-Gm-Message-State: AOAM532JMMG9cZ2jiQszDMULYdVV7G2MXKiCT9SDlKg15gig6aXOCM2X yQoXg9u6Wg6ypNqV6+Yf3mNtcA== X-Received: by 2002:a17:902:a581:b0:154:8c7d:736a with SMTP id az1-20020a170902a58100b001548c7d736amr21954623plb.74.1650480549886; Wed, 20 Apr 2022 11:49:09 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id d16-20020a056a00245000b004f771b48736sm22080232pfj.194.2022.04.20.11.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 11:49:09 -0700 (PDT) Date: Wed, 20 Apr 2022 11:49:09 -0700 (PDT) X-Google-Original-Date: Wed, 20 Apr 2022 11:49:06 PDT (-0700) Subject: Re: [PATCH v1] RISC-V: Add braces around an empty if statement bodies In-Reply-To: <814ae1e7-297f-102f-972f-ae6130128e7a@infradead.org> CC: panqinglin2020@iscas.ac.cn, Paul Walmsley , aou@eecs.berkeley.edu, alexandre.ghiti@canonical.com, jszhang@kernel.org, wangkefeng.wang@huawei.com, mick@ics.forth.gr, vitaly.wool@konsulko.com, rppt@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, lkp@intel.com From: Palmer Dabbelt To: rdunlap@infradead.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 Apr 2022 13:38:42 PDT (-0700), rdunlap@infradead.org wrote: > Hi, > > On 4/19/22 12:48, Palmer Dabbelt wrote: >> From: Palmer Dabbelt >> >> This triggers -Wempty-body, which will cause the next statement (eventually >> create_pmd_mapping) to be dropped. Both of these were introduced by the same >> commit. This is safe for the reporting config (which is 32-bit), but IIUC >> could result in breakages for 64-bit configs without 4/5 level paging like the >> XIP configs. >> >> Reported-by: kernel test robot >> Fixes: 677b9eb8810e ("riscv: mm: Prepare pt_ops helper functions for sv57") >> Signed-off-by: Palmer Dabbelt >> --- >> Might be better to define these to functions that are empty, but that's >> slightly different than just fixing the commit/warning in question. > > Yes, we usually fix this type of problem by changing these to have empty bodies: > > #else > ... > #define create_pud_mapping(__pmdp, __va, __pa, __sz, __prot) > #define create_pmd_mapping(__pmdp, __va, __pa, __sz, __prot) > #endif /* __PAGETABLE_PMD_FOLDED */ > > etc. Ya, that's the right way to do it -- not sure why I was being lazy here. Turns out there was a bunch of other XIP breakage, I sent a v2 that's a whole series. Thanks! > >> --- >> arch/riscv/mm/init.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c >> index 9535bea8688c..637916857c4d 100644 >> --- a/arch/riscv/mm/init.c >> +++ b/arch/riscv/mm/init.c >> @@ -798,13 +798,15 @@ static void __init create_fdt_early_page_table(pgd_t *pgdir, uintptr_t dtb_pa) >> PGDIR_SIZE, >> IS_ENABLED(CONFIG_64BIT) ? PAGE_TABLE : PAGE_KERNEL); >> >> - if (pgtable_l5_enabled) >> + if (pgtable_l5_enabled) { >> create_p4d_mapping(early_dtb_p4d, DTB_EARLY_BASE_VA, >> (uintptr_t)early_dtb_pud, P4D_SIZE, PAGE_TABLE); >> + } >> >> - if (pgtable_l4_enabled) >> + if (pgtable_l4_enabled) { >> create_pud_mapping(early_dtb_pud, DTB_EARLY_BASE_VA, >> (uintptr_t)early_dtb_pmd, PUD_SIZE, PAGE_TABLE); >> + } >> >> if (IS_ENABLED(CONFIG_64BIT)) { >> create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA,