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 62869C83F1D for ; Fri, 11 Jul 2025 10:00:17 +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:In-Reply-To:Subject:Cc:To:From:Message-ID: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=l5m0LzXKx7LjJhuncXCRD1k/1iy1dKYqS+rDNb3MENE=; b=ROg0wlLDc1/jk/59pV2edBzPeF n/vbgtcBW3k/L6NnjT24+dD2T8wOxD9VkZzjaZ4ZnoFfEgjTM+9TazzxAJs51k56Qs4nQWfgoPNwq INxWSOUqinWGIaJN9RwD0ZEMKwMHBBiP0ApqpEKDkTZWIWtY12UrcWUZTtruM14npQi3jsFvbZg6S 7Yl/chIZoGmyJPsEhYgKNwNjUT00zmsWV6wunxa4Uj5WZrGjhCY1InFL4VpBmIa9MDbfhMA4Q4/aQ 3Ra/z/79ZMfNH8AgW9jfy456+TNZ0kXg3q5VWOh3SwO0UyBSoU6U3FWQUnRA0zjs5SRFmdTmiug5A tgrsS/bQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uaAY7-0000000EPRp-20UZ; Fri, 11 Jul 2025 10:00:11 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1ua9Vp-0000000EDhy-3Mot for linux-arm-kernel@lists.infradead.org; Fri, 11 Jul 2025 08:53:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 40EB96144A; Fri, 11 Jul 2025 08:53:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1515C4CEED; Fri, 11 Jul 2025 08:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752224024; bh=mQI53t4QPyDABHATdUC2IVmzwHPIX8ZlllLvLCz6H0M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CfqHolZkPXR+eVlblNsPmPOjAM9RltC64m0ZnuoOMrqj+lWKEXbaARAOxSZPbw5ns 5/g4+z5i4lFbgKFdUs/3Tb9ndkDOBvdnVVTl1FuAxiLMA1NpJ4qNHVgwfUFuBluSGC z8bIhaTB71FZLwgJv0F8gHt+eEiPYSVEfPdKGNVlgqJ3DhNwrZNlNiPAtft3vomFuQ ZtuSf1Hzne+NGq7ZDk0WSY82BTJZ/CZFJ/FFOf7ErKXTQWjfbUHhI1q1Ov/gDGju9b QTju/goVcwGqZAFpd262je5o8e0Cefxa9ispPSmXVSULlKAE1lhGCH25Fvv5k1cztH 92v2iF/HCj3xw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ua9Vm-00EoED-Gl; Fri, 11 Jul 2025 09:53:42 +0100 Date: Fri, 11 Jul 2025 09:53:41 +0100 Message-ID: <86frf39kh6.wl-maz@kernel.org> From: Marc Zyngier To: "Arnd Bergmann" Cc: "Arnd Bergmann" , "Oliver Upton" , "Catalin Marinas" , "Will Deacon" , "Joey Gouly" , "Suzuki K Poulose" , "Zenghui Yu" , "Mark Brown" , "James Morse" , "Sebastian Ott" , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: fix u64_replace_bits() usage In-Reply-To: <4befb9eb-96e6-4a7c-9746-286144564f4e@app.fastmail.com> References: <20250711072752.2781647-1-arnd@kernel.org> <86h5zj9laj.wl-maz@kernel.org> <4befb9eb-96e6-4a7c-9746-286144564f4e@app.fastmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: arnd@arndb.de, arnd@kernel.org, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, broonie@kernel.org, james.morse@arm.com, sebott@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, 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-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, 11 Jul 2025 09:44:23 +0100, "Arnd Bergmann" wrote: > > On Fri, Jul 11, 2025, at 10:36, Marc Zyngier wrote: > > On Fri, 11 Jul 2025 08:27:47 +0100, Arnd Bergmann wrote: > >> if (hpmn > vcpu->kvm->arch.nr_pmu_counters) { > >> hpmn = vcpu->kvm->arch.nr_pmu_counters; > >> - u64_replace_bits(val, hpmn, MDCR_EL2_HPMN); > >> + val = u64_replace_bits(val, hpmn, MDCR_EL2_HPMN); > >> } > >> > >> __vcpu_assign_sys_reg(vcpu, MDCR_EL2, val); > > > > This is only in -next, right? Because I have a fix for this already > > queued for 6.16, as per [1]. > > Yes, as far as I can tell, the warning only showed up in linux-next > after f66f9c3d09c1 ("bitfield: Ensure the return values of helper > functions are checked"). > > As far as I can tell, Ben added the check in linux/bitfield.h > when he sent you his version of the fix, they just ended up > in linux-next in the wrong order, so I ended up recreating his > original fix slightly differently. I don't think Ben's fix is in -next, as I queued it in the kvmarm fixes branch, which isn't pulled by -next. Hopefully Paolo will send this to Linus shortly (pull request here[1]), and -next will be clean again. Thanks, M. [1] https://lore.kernel.org/r/20250711084835.2411230-1-maz@kernel.org -- Without deviation from the norm, progress is not possible.