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 9755BC7EE24 for ; Tue, 6 Jun 2023 17:11: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: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tb12PC+xi2OIcZpjgixIxwWCeLRyGX5SlxzDHxAucdY=; b=fC3UAa+oyoJE2h lp1ibjCPxqcI3JmP+cRXzaSRAlSfxpP9J6vCm81ki6775dkv0R2ut+YSMEg3O0GEubOc3Sl1Zb2KY t0e9WYCNuJmK1w5UWZYAPDqERNzbQQ9mO1G5dQ/g6WXNfKzXpnrfpHhEnD9Bb3IRHhPXIopnvwGBF UxvNi20teu46yTH/Zs5sVHfgIgCYCm0hwFhyw9F60aCup9WIZxlziO19kqAF1S0K0riNXP25hb8ua cpd1TWeTRXpDHbU6FqwXfxSZHCh4JbwMVe/ij9aHNFGP1wIHYJK/tWj6MZaVK40z2JzkT1IMdJSHX gg+koI9cmjeJCPLdxVdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6aCn-002YKB-2A; Tue, 06 Jun 2023 17:10:49 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6aCk-002YIw-30 for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2023 17:10:48 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D1A262E4E; Tue, 6 Jun 2023 17:10:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADB95C433D2; Tue, 6 Jun 2023 17:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686071445; bh=z6sz91MRATzTZbRLgJHMdnl08AW9XjGtfAyBuMhixws=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bgFQDc0n9a4wP8vjEGq5bR1aVIvOgZu9WEq88MFjgCAOLOhc8BBofPF8qmRRIsqEQ 41SNHbvid/KnIp9L+krDQOVt95cpnBcFiGtthqw7lGl31gHZuspXtthnKpEvIJNBTc lOMfTLLXoPRxlqvsNJJSnskQxX6EHymDy/TfbAqyb6MKnQjg9/08zH9BwYJlkX1h4N Uq4KAfp8NTfJo8YuShSCjhhLEkkWCksR+ThkI7wFTHYatUJPMClV0rYYSZKv/x05e7 SeAiO7OOri5H3b6bGWCImiZD+31TFOzjQPSFybU9G7mK33TIYslmDqQTLKEeLmADUd zeZhTkYFNabZA== Received: from 152.5.30.93.rev.sfr.net ([93.30.5.152] helo=wait-a-minute.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 1q6aCh-003Gvi-Gp; Tue, 06 Jun 2023 18:10:43 +0100 Date: Tue, 06 Jun 2023 18:10:42 +0100 Message-ID: <87ilc0o6st.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: Sebastian Ott , Sean Christopherson , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] KVM: arm64: Fix smp_processor_id() call in preemptible context In-Reply-To: References: <2f16f83e-ed60-fcb7-7f3d-0fa216c41cb9@redhat.com> <87pm68o99d.wl-maz@kernel.org> 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/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 93.30.5.152 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, sebott@redhat.com, seanjc@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.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-20230606_101047_040702_5F7B5574 X-CRM114-Status: GOOD ( 28.17 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 06 Jun 2023 17:48:14 +0100, Oliver Upton wrote: > > On Tue, Jun 06, 2023 at 05:17:34PM +0100, Marc Zyngier wrote: > > On Tue, 06 Jun 2023 15:10:44 +0100, Oliver Upton wrote: > > > diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c > > > index 491ca7eb2a4c..933a6331168b 100644 > > > --- a/arch/arm64/kvm/pmu-emul.c > > > +++ b/arch/arm64/kvm/pmu-emul.c > > > @@ -700,7 +700,7 @@ static struct arm_pmu *kvm_pmu_probe_armpmu(void) > > > > > > mutex_lock(&arm_pmus_lock); > > > > > > - cpu = smp_processor_id(); > > > + cpu = raw_smp_processor_id(); > > > list_for_each_entry(entry, &arm_pmus, entry) { > > > tmp = entry->arm_pmu; > > > > > > > > > > If preemption doesn't matter (and I really don't think it does), why > > are we looking for a the current CPU? I'd rather we pick the PMU that > > is associated with CPU0 (we're pretty sure it exists), and be done > > with it. > > Getting the current CPU is still useful, we just don't care about that > cpu# being stale. Unconditionally using CPU0 could break existing usage > patterns. > > A not-too-contrived example would be to taskset QEMU onto a cluster of > cores in a big.LITTLE system (I do this). The current behavior would > assign the right PMU to the guest. I've made my opinions about the 'old' > ABI quite clear, but I don't have too great of an appetite for breakage, > though fragile. Fair enough. > > Can we proceed with the fix I had suggested along with a more complete > description of the baggage that we're carrying? Sure. Please post a separate patch and I'll queue that together with Reiji's EL0 PMU stuff for the next bag of fixes. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel