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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 14761C3DA59 for ; Mon, 15 Jul 2024 10:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Message-ID:In-Reply-To:Subject:cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GH/UMjm9Bv3Ls7RPi1qyRi7O73kNYwzhssTIeV97gbM=; b=Cr2FhKTvi12RV7f6B9nNc+2A0t 3fQO6QMvqjbQq/xiOuRzdQ+TeTf3Yv2ke9gPNLNe9XQZLL6JEnJJAboH3tUXm5efg9oJaAwBQDLwA JBg1vx5j18CeWEzqGzkr0ECapkOXEJjCNQ2zk65FINdAODbOzGZbmJmtqNesMgIvu4U2EtCQVDrUy sWmayeumZ2koAFEbygOhuptzqk0RsA242eh7h7zCE+vgYCvr0CudWTBs/wXcqWd5/dfFZIFsc9z6g qcL02eFHReSdTZsijml8GWNdS8ie0KiHSZmJi2ocXg77zcbsjE0JcsficjaIZh8fuResYyZ9i0qEQ QEcIkOhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTIwe-00000006hFp-2R6f; Mon, 15 Jul 2024 10:28:36 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTIwK-00000006h9K-43uZ for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 10:28:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721039294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GH/UMjm9Bv3Ls7RPi1qyRi7O73kNYwzhssTIeV97gbM=; b=EiQTBJFsfKf6Lris2ySpcX8CbyxBOt52BAy4HtZvDbPPcih1RWtFbeIWGsO1M08WRaNeAC mdQQBUNs+MTgLw3gHoXOzLAteikHfkPpQn0gx3L5YouD6pCuyVDa0ZPGYOv/x4hsFkPZs3 g/El0XXMpWozh650nlyyLpM9oJpLxeA= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-Nur4SRmCMOyrCAX8zK9ShA-1; Mon, 15 Jul 2024 06:28:11 -0400 X-MC-Unique: Nur4SRmCMOyrCAX8zK9ShA-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6b5ebdd8109so62016676d6.0 for ; Mon, 15 Jul 2024 03:28:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721039290; x=1721644090; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GH/UMjm9Bv3Ls7RPi1qyRi7O73kNYwzhssTIeV97gbM=; b=brVywrDmDCC168xUSeu5LqhA0OHE7EpC2fGz1ayXPP/q04HxB9hSHiLUHhWBVX4H9p Kk9NhxC9BpRmaJjg3qIqpdILoa9XqS7lJT47hK+M+80Ey2AvkCv65fSQ0M53XEmTUFXg kGrok2Yfwz3CbSiTViMy5Emnb+f0b3k5pnfniIs3ZoX4FNPng8lCI/76tXCL+LC08ir0 dxkXxvMNRqd1UFv0mFO/Xoz9uxcZt6/fLG+nZfpK/V4zayOpITuN7UCdd1wRFGgQF3cJ /zRNVxAqkI+kdaZFieI7zmJ7/OKCWH8m2v2iyEEUx8Z5pxw+m7qnBwWEXsItlre6FjTB LxpQ== X-Gm-Message-State: AOJu0Yw4oQBnwbnqhwTTkQtrKerrxZuqBcm1mfxqjmh9c5lkfAWHd0kc dBTvDLiWx+qmkAz/byBznuxdl+DlDAK1/gXDy+o1sqczrNv+paiam2hzE4rAlqePROGSFelpUg5 dq9qauzlms6cA/0ilO9GZSeSHN0ZAWGUnlR76sQHSec/bi8chX+ofxGBx0heOWiUtTzpsz8Gu X-Received: by 2002:ad4:5aa5:0:b0:6b0:86ab:fe89 with SMTP id 6a1803df08f44-6b61bf24454mr253416246d6.33.1721039290703; Mon, 15 Jul 2024 03:28:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtZ5aPh6SJPX0vALIcQbxvBsBt7/FyT5/BtnGUEqoH9PUJwi4W3cEfWV3d6Sx5qRQ1lvAo8A== X-Received: by 2002:ad4:5aa5:0:b0:6b0:86ab:fe89 with SMTP id 6a1803df08f44-6b61bf24454mr253416076d6.33.1721039290402; Mon, 15 Jul 2024 03:28:10 -0700 (PDT) Received: from rh (p200300c93f45e50062e5f8c654844c9a.dip0.t-ipconnect.de. [2003:c9:3f45:e500:62e5:f8c6:5484:4c9a]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b761a10d8fsm20015876d6.99.2024.07.15.03.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 03:28:10 -0700 (PDT) Date: Mon, 15 Jul 2024 12:28:06 +0200 (CEST) From: Sebastian Ott To: Marc Zyngier cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Oliver Upton , James Morse , Suzuki K Poulose , Catalin Marinas , Will Deacon , Zenghui Yu Subject: Re: [PATCH 1/3] KVM: arm64: fix override-init warnings in W=1 builds In-Reply-To: <8734oep96j.wl-maz@kernel.org> Message-ID: <3b882ac0-fd2c-35df-38d7-b89cf073bcc3@redhat.com> References: <20240712110332.10970-1-sebott@redhat.com> <20240712110332.10970-2-sebott@redhat.com> <8734oep96j.wl-maz@kernel.org> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII; format=flowed X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_032817_105773_DA6332E2 X-CRM114-Status: GOOD ( 20.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 12 Jul 2024, Marc Zyngier wrote: > On Fri, 12 Jul 2024 12:03:30 +0100, > Sebastian Ott wrote: >> >> Remove double initializations in cases where that's easily possible >> - like extra NULL initialization in static global structures. In the >> other cases just silence -Woverride-init. >> >> To fix warnings like the following: >> arch/arm64/kvm/hyp/vhe/switch.c:271:43: warning: initialized field overwritten [-Woverride-init] >> 271 | [ESR_ELx_EC_CP15_32] = kvm_hyp_handle_cp15_32, >> | ^~~~~~~~~~~~~~~~~~~~~~ >> >> Signed-off-by: Sebastian Ott >> --- >> arch/arm64/kvm/handle_exit.c | 5 +++++ >> arch/arm64/kvm/hyp/nvhe/switch.c | 6 ++---- >> arch/arm64/kvm/hyp/vhe/switch.c | 3 +-- >> arch/arm64/kvm/sys_regs.c | 5 +++++ >> 4 files changed, 13 insertions(+), 6 deletions(-) >> >> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c >> index d7c2990e7c9e..2c049746657c 100644 >> --- a/arch/arm64/kvm/handle_exit.c >> +++ b/arch/arm64/kvm/handle_exit.c >> @@ -291,6 +291,9 @@ static int handle_svc(struct kvm_vcpu *vcpu) >> return 1; >> } >> >> +__diag_push(); >> +__diag_ignore_all("-Woverride-init", "Allow field overrides in exit_handlers"); > > The wording you are looking for is "Silence stupid warning". I really > mean it. There is really nothing wrong with this code, and if the > compiler doesn't understand the purpose of a default initialiser, then > *maybe* it should be fixed rather than polluting the kernel with this > stuff. > [...] >> -static const exit_handler_fn hyp_exit_handlers[] = { >> - [0 ... ESR_ELx_EC_MAX] = NULL, >> +static const exit_handler_fn hyp_exit_handlers[ESR_ELx_EC_MAX + 1] = { > > Is this really any better? I don't think so. It makes the intent > disappear instead of making it explicit. Intent matters *a lot*. I'm not claiming that it's an improvement to the code. But yea, I see your point. How about disabling that flag in the makefile? Thanks, Sebastian