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.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 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 18BF7C83001 for ; Thu, 30 Apr 2020 08:02:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7DE12173E for ; Thu, 30 Apr 2020 08:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588233777; bh=CUYYSoHe/SJ7OBaDeNT/SGKVo1AeXEXbzgXx9L8eOzA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=SVsZS6ztjOFOKni8PYx/4WVnGlC2TJWp82eKLwyygzchfqCKPsilghpCyh2cL7Xz4 lOPWc3eNCvj5YDulzoT2XKIZq3I5tzqSScWaYf+5a0qt8zGdAhJTYGUNnyu5jAlTzW ha9iun5vo4gfxV2+5jPSefK8yC54Bx2ikWRVZwHQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726598AbgD3IC5 (ORCPT ); Thu, 30 Apr 2020 04:02:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:49686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbgD3IC4 (ORCPT ); Thu, 30 Apr 2020 04:02:56 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B16B820838; Thu, 30 Apr 2020 08:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588233775; bh=CUYYSoHe/SJ7OBaDeNT/SGKVo1AeXEXbzgXx9L8eOzA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dizua03G+LGrckPmeKgtKUFZU1P076tMsXhcAo8Hte0Bm0nyVg6cOKHlakWsfxjnd Ll1mG7HptmW7+8VZ19PLS4AybRZTzhpK4CVNHPTlhQRHpcwxfLoIDvKDU+yA2EvbPs lSkhlpNT0BIDYufx3/VGDDeyH0umhgIp8Uh3MvFA= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jU49m-007xMt-22; Thu, 30 Apr 2020 09:02:54 +0100 Date: Thu, 30 Apr 2020 09:02:51 +0100 From: Marc Zyngier To: Arnd Bergmann Cc: Mike Rapoport , Andrew Morton , Benjamin Herrenschmidt , Brian Cain , Catalin Marinas , Christophe Leroy , Fenghua Yu , Geert Uytterhoeven , Guan Xuetao , James Morse , Jonas Bonn , Julien Thierry , Ley Foon Tan , Michael Ellerman , Paul Mackerras , Rich Felker , Russell King , Stafford Horne , Stefan Kristiansson , Suzuki K Poulose , Tony Luck , Will Deacon , Yoshinori Sato , Stephen Rothwell , Paolo Bonzini , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: kvm: fix gcc-10 shift warning Message-ID: <20200430090251.715f6bf0@why> In-Reply-To: <20200429185657.4085975-1-arnd@arndb.de> References: <20200429185657.4085975-1-arnd@arndb.de> Organization: Approximate X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: arnd@arndb.de, rppt@linux.ibm.com, akpm@linux-foundation.org, benh@kernel.crashing.org, bcain@codeaurora.org, catalin.marinas@arm.com, christophe.leroy@c-s.fr, fenghua.yu@intel.com, geert+renesas@glider.be, gxt@pku.edu.cn, james.morse@arm.com, jonas@southpole.se, julien.thierry.kdev@gmail.com, ley.foon.tan@intel.com, mpe@ellerman.id.au, paulus@samba.org, dalias@libc.org, linux@armlinux.org.uk, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, suzuki.poulose@arm.com, tony.luck@intel.com, will@kernel.org, ysato@users.sourceforge.jp, sfr@canb.auug.org.au, pbonzini@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 29 Apr 2020 20:56:20 +0200 Arnd Bergmann wrote: > gcc-10 warns that the 32-bit zero cannot be shifted more than > 32 bits to the right: > > arch/arm64/kvm/../../../virt/kvm/arm/mmu.c: In function 'clear_hyp_p4d_entry': > arch/arm64/include/asm/pgtable.h:630:35: error: right shift count >= width of type [-Werror=shift-count-overflow] > 630 | #define pud_index(addr) (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)) > | ^~ > arch/arm64/include/asm/memory.h:271:45: note: in definition of macro '__phys_to_virt' > 271 | #define __phys_to_virt(x) ((unsigned long)((x) - physvirt_offset)) > | ^ > arch/arm64/include/asm/pgtable.h:633:42: note: in expansion of macro '__va' > 633 | #define pud_offset(dir, addr) ((pud_t *)__va(pud_offset_phys((dir), (addr)))) > | ^~~~ > arch/arm64/include/asm/pgtable.h:632:73: note: in expansion of macro 'pud_index' > 632 | #define pud_offset_phys(dir, addr) (p4d_page_paddr(READ_ONCE(*(dir))) + pud_index(addr) * sizeof(pud_t)) > | ^~~~~~~~~ > arch/arm64/include/asm/pgtable.h:633:47: note: in expansion of macro 'pud_offset_phys' > 633 | #define pud_offset(dir, addr) ((pud_t *)__va(pud_offset_phys((dir), (addr)))) > | ^~~~~~~~~~~~~~~ > arch/arm64/kvm/../../../virt/kvm/arm/mmu.c:510:36: note: in expansion of macro 'pud_offset' > 510 | pud_t *pud_table __maybe_unused = pud_offset(p4d, 0); > | ^~~~~~~~~~ > > This is harmless, and the warning is a little bit silly for > a zero constant, but it's trivial to fix by making it an > unsigned long, so do that. > > Fixes: 22998131ab33 ("arm64: add support for folded p4d page tables") > Signed-off-by: Arnd Bergmann > --- > virt/kvm/arm/mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index 48d4288c5f1b..534d9798c3cb 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -507,7 +507,7 @@ static void clear_hyp_pgd_entry(pgd_t *pgd) > > static void clear_hyp_p4d_entry(p4d_t *p4d) > { > - pud_t *pud_table __maybe_unused = pud_offset(p4d, 0); > + pud_t *pud_table __maybe_unused = pud_offset(p4d, 0UL); > VM_BUG_ON(p4d_huge(*p4d)); > p4d_clear(p4d); > pud_free(NULL, pud_table); Acked-by: Marc Zyngier M. -- Jazz is not dead. It just smells funny... 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.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=unavailable 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 C061DC83009 for ; Thu, 30 Apr 2020 08:03:03 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 3A4852173E for ; Thu, 30 Apr 2020 08:03:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="dizua03G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A4852173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A77214B3B9; Thu, 30 Apr 2020 04:03:02 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id paqXemfDLx8Q; Thu, 30 Apr 2020 04:03:01 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 868D84B3BA; Thu, 30 Apr 2020 04:03:01 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id EE2574B39B for ; Thu, 30 Apr 2020 04:02:59 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MkqdnW2t7sYb for ; Thu, 30 Apr 2020 04:02:57 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 0F8364B387 for ; Thu, 30 Apr 2020 04:02:57 -0400 (EDT) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B16B820838; Thu, 30 Apr 2020 08:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588233775; bh=CUYYSoHe/SJ7OBaDeNT/SGKVo1AeXEXbzgXx9L8eOzA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dizua03G+LGrckPmeKgtKUFZU1P076tMsXhcAo8Hte0Bm0nyVg6cOKHlakWsfxjnd Ll1mG7HptmW7+8VZ19PLS4AybRZTzhpK4CVNHPTlhQRHpcwxfLoIDvKDU+yA2EvbPs lSkhlpNT0BIDYufx3/VGDDeyH0umhgIp8Uh3MvFA= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jU49m-007xMt-22; Thu, 30 Apr 2020 09:02:54 +0100 Date: Thu, 30 Apr 2020 09:02:51 +0100 From: Marc Zyngier To: Arnd Bergmann Subject: Re: [PATCH] arm64: kvm: fix gcc-10 shift warning Message-ID: <20200430090251.715f6bf0@why> In-Reply-To: <20200429185657.4085975-1-arnd@arndb.de> References: <20200429185657.4085975-1-arnd@arndb.de> Organization: Approximate X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: arnd@arndb.de, rppt@linux.ibm.com, akpm@linux-foundation.org, benh@kernel.crashing.org, bcain@codeaurora.org, catalin.marinas@arm.com, christophe.leroy@c-s.fr, fenghua.yu@intel.com, geert+renesas@glider.be, gxt@pku.edu.cn, james.morse@arm.com, jonas@southpole.se, julien.thierry.kdev@gmail.com, ley.foon.tan@intel.com, mpe@ellerman.id.au, paulus@samba.org, dalias@libc.org, linux@armlinux.org.uk, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, suzuki.poulose@arm.com, tony.luck@intel.com, will@kernel.org, ysato@users.sourceforge.jp, sfr@canb.auug.org.au, pbonzini@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: Rich Felker , Geert Uytterhoeven , Benjamin Herrenschmidt , Paul Mackerras , Will Deacon , kvmarm@lists.cs.columbia.edu, Jonas Bonn , Stephen Rothwell , Brian Cain , Michael Ellerman , Russell King , Ley Foon Tan , Mike Rapoport , Catalin Marinas , Fenghua Yu , Stefan Kristiansson , Stafford Horne , Guan Xuetao , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Tony Luck , Yoshinori Sato , linux-kernel@vger.kernel.org, Paolo Bonzini , Andrew Morton X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Wed, 29 Apr 2020 20:56:20 +0200 Arnd Bergmann wrote: > gcc-10 warns that the 32-bit zero cannot be shifted more than > 32 bits to the right: > > arch/arm64/kvm/../../../virt/kvm/arm/mmu.c: In function 'clear_hyp_p4d_entry': > arch/arm64/include/asm/pgtable.h:630:35: error: right shift count >= width of type [-Werror=shift-count-overflow] > 630 | #define pud_index(addr) (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)) > | ^~ > arch/arm64/include/asm/memory.h:271:45: note: in definition of macro '__phys_to_virt' > 271 | #define __phys_to_virt(x) ((unsigned long)((x) - physvirt_offset)) > | ^ > arch/arm64/include/asm/pgtable.h:633:42: note: in expansion of macro '__va' > 633 | #define pud_offset(dir, addr) ((pud_t *)__va(pud_offset_phys((dir), (addr)))) > | ^~~~ > arch/arm64/include/asm/pgtable.h:632:73: note: in expansion of macro 'pud_index' > 632 | #define pud_offset_phys(dir, addr) (p4d_page_paddr(READ_ONCE(*(dir))) + pud_index(addr) * sizeof(pud_t)) > | ^~~~~~~~~ > arch/arm64/include/asm/pgtable.h:633:47: note: in expansion of macro 'pud_offset_phys' > 633 | #define pud_offset(dir, addr) ((pud_t *)__va(pud_offset_phys((dir), (addr)))) > | ^~~~~~~~~~~~~~~ > arch/arm64/kvm/../../../virt/kvm/arm/mmu.c:510:36: note: in expansion of macro 'pud_offset' > 510 | pud_t *pud_table __maybe_unused = pud_offset(p4d, 0); > | ^~~~~~~~~~ > > This is harmless, and the warning is a little bit silly for > a zero constant, but it's trivial to fix by making it an > unsigned long, so do that. > > Fixes: 22998131ab33 ("arm64: add support for folded p4d page tables") > Signed-off-by: Arnd Bergmann > --- > virt/kvm/arm/mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index 48d4288c5f1b..534d9798c3cb 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -507,7 +507,7 @@ static void clear_hyp_pgd_entry(pgd_t *pgd) > > static void clear_hyp_p4d_entry(p4d_t *p4d) > { > - pud_t *pud_table __maybe_unused = pud_offset(p4d, 0); > + pud_t *pud_table __maybe_unused = pud_offset(p4d, 0UL); > VM_BUG_ON(p4d_huge(*p4d)); > p4d_clear(p4d); > pud_free(NULL, pud_table); Acked-by: Marc Zyngier M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable 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 0FE43C83006 for ; Thu, 30 Apr 2020 08:03:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D309B2173E for ; Thu, 30 Apr 2020 08:03:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ijw5/x88"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="dizua03G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D309B2173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MD6ZNb9+VSYSVYvXkqqdUxIN7ioEZ9WBFIA5Fuqak70=; b=Ijw5/x88lQ+BTG bBE8vdjh8aXTPBZiYj57p/znJO1iyq0xMtn2YK1ofkfvkKh5M4HslZneLXB985Ha2yMdxyXi7u1HB tPI+siQLEmfLWjv6KG5oz6Mw9AgMyhzhYf/v50FoUVh8p5+kiF1VQmmHgFxnhPViLPWAHznFCLgUr ioZe9GIV83Be6gzc6QfB52WbUko8g01yL0aFC4mvgMqmPF9CXA4+UOZgr2Wp2U/d+aDENMiFdM/6p iCQab484rJ8H9VDg/eJgRjTddlhzQONKb67rsoZRT8D4fn5JwbZXPQPj8obVWJPkDoDXyTtGlxdvX E/bOY7e0d5670uml08kw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jU49s-0005wG-6W; Thu, 30 Apr 2020 08:03:00 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jU49o-0005vQ-84 for linux-arm-kernel@lists.infradead.org; Thu, 30 Apr 2020 08:02:57 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B16B820838; Thu, 30 Apr 2020 08:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588233775; bh=CUYYSoHe/SJ7OBaDeNT/SGKVo1AeXEXbzgXx9L8eOzA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dizua03G+LGrckPmeKgtKUFZU1P076tMsXhcAo8Hte0Bm0nyVg6cOKHlakWsfxjnd Ll1mG7HptmW7+8VZ19PLS4AybRZTzhpK4CVNHPTlhQRHpcwxfLoIDvKDU+yA2EvbPs lSkhlpNT0BIDYufx3/VGDDeyH0umhgIp8Uh3MvFA= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jU49m-007xMt-22; Thu, 30 Apr 2020 09:02:54 +0100 Date: Thu, 30 Apr 2020 09:02:51 +0100 From: Marc Zyngier To: Arnd Bergmann Subject: Re: [PATCH] arm64: kvm: fix gcc-10 shift warning Message-ID: <20200430090251.715f6bf0@why> In-Reply-To: <20200429185657.4085975-1-arnd@arndb.de> References: <20200429185657.4085975-1-arnd@arndb.de> Organization: Approximate X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: arnd@arndb.de, rppt@linux.ibm.com, akpm@linux-foundation.org, benh@kernel.crashing.org, bcain@codeaurora.org, catalin.marinas@arm.com, christophe.leroy@c-s.fr, fenghua.yu@intel.com, geert+renesas@glider.be, gxt@pku.edu.cn, james.morse@arm.com, jonas@southpole.se, julien.thierry.kdev@gmail.com, ley.foon.tan@intel.com, mpe@ellerman.id.au, paulus@samba.org, dalias@libc.org, linux@armlinux.org.uk, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, suzuki.poulose@arm.com, tony.luck@intel.com, will@kernel.org, ysato@users.sourceforge.jp, sfr@canb.auug.org.au, pbonzini@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200430_010256_802669_5643B49D X-CRM114-Status: GOOD ( 17.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , Geert Uytterhoeven , Benjamin Herrenschmidt , Paul Mackerras , Will Deacon , kvmarm@lists.cs.columbia.edu, Jonas Bonn , Stephen Rothwell , Brian Cain , Michael Ellerman , Russell King , Ley Foon Tan , Mike Rapoport , Catalin Marinas , Julien Thierry , Fenghua Yu , Suzuki K Poulose , Stefan Kristiansson , Stafford Horne , Guan Xuetao , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Tony Luck , Yoshinori Sato , linux-kernel@vger.kernel.org, James Morse , Paolo Bonzini , Andrew Morton Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 29 Apr 2020 20:56:20 +0200 Arnd Bergmann wrote: > gcc-10 warns that the 32-bit zero cannot be shifted more than > 32 bits to the right: > > arch/arm64/kvm/../../../virt/kvm/arm/mmu.c: In function 'clear_hyp_p4d_entry': > arch/arm64/include/asm/pgtable.h:630:35: error: right shift count >= width of type [-Werror=shift-count-overflow] > 630 | #define pud_index(addr) (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)) > | ^~ > arch/arm64/include/asm/memory.h:271:45: note: in definition of macro '__phys_to_virt' > 271 | #define __phys_to_virt(x) ((unsigned long)((x) - physvirt_offset)) > | ^ > arch/arm64/include/asm/pgtable.h:633:42: note: in expansion of macro '__va' > 633 | #define pud_offset(dir, addr) ((pud_t *)__va(pud_offset_phys((dir), (addr)))) > | ^~~~ > arch/arm64/include/asm/pgtable.h:632:73: note: in expansion of macro 'pud_index' > 632 | #define pud_offset_phys(dir, addr) (p4d_page_paddr(READ_ONCE(*(dir))) + pud_index(addr) * sizeof(pud_t)) > | ^~~~~~~~~ > arch/arm64/include/asm/pgtable.h:633:47: note: in expansion of macro 'pud_offset_phys' > 633 | #define pud_offset(dir, addr) ((pud_t *)__va(pud_offset_phys((dir), (addr)))) > | ^~~~~~~~~~~~~~~ > arch/arm64/kvm/../../../virt/kvm/arm/mmu.c:510:36: note: in expansion of macro 'pud_offset' > 510 | pud_t *pud_table __maybe_unused = pud_offset(p4d, 0); > | ^~~~~~~~~~ > > This is harmless, and the warning is a little bit silly for > a zero constant, but it's trivial to fix by making it an > unsigned long, so do that. > > Fixes: 22998131ab33 ("arm64: add support for folded p4d page tables") > Signed-off-by: Arnd Bergmann > --- > virt/kvm/arm/mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index 48d4288c5f1b..534d9798c3cb 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -507,7 +507,7 @@ static void clear_hyp_pgd_entry(pgd_t *pgd) > > static void clear_hyp_p4d_entry(p4d_t *p4d) > { > - pud_t *pud_table __maybe_unused = pud_offset(p4d, 0); > + pud_t *pud_table __maybe_unused = pud_offset(p4d, 0UL); > VM_BUG_ON(p4d_huge(*p4d)); > p4d_clear(p4d); > pud_free(NULL, pud_table); Acked-by: Marc Zyngier M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel