From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796374097; b=2cY8QqmHDqpPS7CRkqdTWM9b3VEH4frhHSjfLtcIRp4pMpyl4Ay74yBHwvZ7I+yBg1+z 2aIZCEZQkqwTZlJKuf1payDVrcLT4mWtun7HP0KcWoNSBPEJAYo0kswIBFEAYFsos7TgL eOUFBvm0qdZyQWgrINLb4zveY/K26sgPgiBWNUNuZRy7qL3FN8H6gzF7MOOCCbALaNqvr d63NbXzFEcfFc+5szk2G09rxTGgqAbFIYCXigU6GYqwCZteRKR3mCDQjDA+p7FFFRAEIw eyScyBTxaJpN/rUuXMa+vir81FIQyTXRodo6TAtAeE0wRqwOu/pisYko9HRI7iBoi5A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796374097; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Subject:Date:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer; bh=KHQKVs8Dmd6T9olc3xYyL8pxqerAAqj+0VSRLpfJqR0=; b=RK2EF9VWZuasYEhwVzsseAOX/VjJqB8ebxtOqsK0SkXAhU0xkKzpM+AYQda30UpLdRnH L7e689LJXYUJFnhAFNU/x82v5+UtHwBFFgUYk38mrlElx6TMD35tyi3Nz4DqNHjHYauED J+DS2BTcdui6ixPlnueST9V2OcbsS+LKjFqPrhrdLgto42xDGPEuHhtNIxpawmYS3yBRy M/drsbecmtMmHLxiN+jfxuFGCNO7JGeRkbQFJaIaAAdHqbTDmgRv7SzJ9Oi+tARLGTble 6yOROGm05l/Hn/wYOBqXvH8jwVuHmsdd28oIdQhzbJc76AcLTM3eU/vN6m1tsyPdMdw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pereq.eu; spf=pass smtp.mailfrom=cryspen.com; dkim=pass header.d=pereq.eu header.i=@pereq.eu header.a=rsa-sha256 header.s=google header.b=BBYCZKXH; arc=none smtp.remote-ip=209.85.221.52 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E71C606A684 for ; Fri, 4 Dec 2026 08:48:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8E71C606A684 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pereq.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cryspen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pereq.eu header.i=@pereq.eu header.a=rsa-sha256 header.s=google header.b=BBYCZKXH Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-492f0a1b685so595253f8f.0 for ; Fri, 04 Dec 2026 00:48:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pereq.eu; s=google; t=1796374095; x=1796978895; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=KHQKVs8Dmd6T9olc3xYyL8pxqerAAqj+0VSRLpfJqR0=; b=BBYCZKXHGuQSmV7N5cY7UJmWoeoV0MI7K9Cd0juweEbFOwiA1nF9QDmr8GWoyqlaj1 stR1FAVSYKc6dzv0xFFHCme4Z36OGFME1PXjbhiBWQ1SqvDHVxWN+lAWi9/PpyyVXroD 1t8KIsh/5ZbCQSeejv9mWljLV/eDgOh13RfsadeRyo4pV1fUOVCPvCFEAZCm+984x6cN pyaE74fqvDIkIDuabBmd7fCqnFvKVE5b8JQbVTfUHwqr0McLbMwcdwAuRGlDOhpzCeQo gYklJ2/c0nnNvYEiXg6DDMIlirHULFxmDEK4ePNJRRwPdlkKrSpW8sQtloHDaW4meeqs MNDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796374095; x=1796978895; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=KHQKVs8Dmd6T9olc3xYyL8pxqerAAqj+0VSRLpfJqR0=; b=mg7daYbuqwCXMcX5seA+RP6T5JxvMLpRrhUQMbwNN7c+/sPT+j3NDfcdJav/Kvq/pD mQZPGO66S6zuU0bheArHuoKYi/ORBO72iTPbUNV8QQ71b/phsN/bhGK7p2JHB7LhxNII glYOTHD66ExM5giPj7LetyyZhkQDMZJBRLs8Eknh1Fzxp08uH1geIuSvLKQEKIH+f4/L BOSRR9fAbK1R2FrEXORbLd97KIi5UeXHkSaP6By3J+x/FR5iAtamElyyLzB7AnCrhkmj opZL14HIxqmKlSyl+19h0IEhGTdAj53QvZGKSLwkiDLyuKJ+wpGopkSKLfAXDhdAK+im EHaw== X-Forwarded-Encrypted: i=1; AL+hErEePBkwOH4Sx1GaINlpbJ/T3z99IzyyxKdrzVINGUFdLMoBlCV8KZeRulP3cYsNF9egapgukPtDxQG1Hdw=@vger.kernel.org X-Gm-Message-State: APuU4Z/Fpc2DXv7SrxYWLka3M7zR9hw/0Ij5Z4ZbuMgSa6NhDkJvHn2Y yGbGGAZCVkYd2o7L4k2ArPg3a6DLutUeQycENGqGl/7zsRLJqjZJAHzwaTaJqzIJ0Mk= X-Gm-Gg: AZFdTZcDz5SiKa9UkAsHCpPQ/g1n1nOfAHgFVt7ROU8QYKYCF1Rrlbl78u/+Aweg9b/ pX9iR4T4KKoWFaWY6OY4CNyiE5RBVrhrP6dU7JviZEvH1ectdVrJkfEJBqTpcNJcrQOBItF6vWl wChRzvxdviGjQx+9J2RlU0fY7nZ7L1cNKc7RAza7809jSPDF3WX2il6SMvk6JcZQzDYccTCn8NB 1d44SH1hsyju2W0IOTLtxKgd9FcUvacA5lv1sVomk4jSWzNta1JMdr+REf+26SU87qCi6Ex00vA rTI9pKMe08tw0QEwQ0uCZu7NpKvlqv1zV78/V83CuRBSnIBNDPwDlwvtXOAZL5lzrMtVENgn7DK e9Va65Vyce0gbAniGUU7mtnEgQz4aWrHx+JgvSPwkWlGte/F3MH9pyGMsEV9TsrcKu1WSe93MSh FJTNBpklwBaFS6Bv+PqfYM25fiH56S9oqzsNTLdkhdkrLHunubcbAlNfXXExh09uNpltbpRttRh nmYzdtq7e2p1UNHuY4gssmjLupEDfYjWVR3dQbHImU0DOp6/B2WXvY1g7qFjIIwhBbYc6yWsQII D7DAZZWWbImEDaL/U04= X-Received: by 2002:a05:6000:387:b0:48f:d7cd:a5af with SMTP id ffacd0b85a97d-4d1dcb0ce87mr2644412f8f.0.1796374094905; Fri, 04 Dec 2026 00:48:14 -0800 (PST) Received: from localhost ([2c0f:3d00:6be:8900:ce5e:9212:ea4b:f30]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d168a63852sm4003744f8f.0.2026.12.04.00.48.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 00:48:14 -0800 (PST) From: Dan Carpenter Subject: [PATCH v4 0/9] KVM: arm64: Fix kvm_reset_vcpu() and SError handling for nested virt Date: Fri, 04 Dec 2026 11:48:04 +0300 Message-Id: <20261204-double_exception_v4-v4-0-523921511673@pereq.eu> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/22MQQqDMBQFryJ/3UCSStVepRRJ4rOmlCj5KoJ49 ybt1uU85s1OjOjBdC92ilg9+zEkKC8FucGEF4TvEpOW+qa0vIpuXOwHLTaHaU5yu5bC1nUDWfW qUYrSc4ro/farPp5/5sW+4eacyoY1DGGjCW7I02k0KXQcX8vrhkSiAAAA X-Change-ID: 20261203-double_exception_v4-b889e07f1911 To: Marc Zyngier , Oliver Upton , Fuad Tabba , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Marcelo Tosatti , Rusty Russell , James Morse , Eric Auger , Sebastian Ott , Paolo Bonzini , Sean Christopherson , Shuah Khan Cc: Karthik Bhargavan , =?utf-8?q?Cl=C3=A9ment_Blaudeau?= , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, Dan Carpenter , Sashiko , stable@vger.kernel.org X-Mailer: b4 0.16.0 Our formal proof work at Pereq found a way to trigger a WARN() by injecting two SErrors. That single patch evolved into 8 fixes and a self test. Changes in v4: Remove a pointless comment from patch 3. Add Steffen's R-b tag to patches, 3 and 4. Fix a Sashiko bug in the selftest. Changes in v3: PATCH 1: KVM: arm64: nv: Use a vcpu request to reprogram the PMU This is a new patch. Sashiko found a sleeping in atomic bug. Move kvm_pmu_nested_transition() to a vCPU request to fix this as Oliver Upton suggested. PATCH 3: KVM: arm64: Reset SP_EL1, ELR_EL1 and SPSR_EL1 when resetting a vcpu Do this in kvm_reset_vcpu_core() which is the shared helper with s390 as Suzuki Poulose suggested. PATCH 6: KVM: arm64: nv: Replace a pending SError when injecting a new one Improve the commit message as Oliver requested Changes in v2: Added 7 new bug fixes and a selftest. - Link to v2: https://lore.kernel.org/all/20261125-double_exception-v2-0-224689d8a764@pereq.eu/ Included in v1: [PATCH v2 7/8] KVM: arm64: nv: Re-inject a stored SError after the exit is handled - Link to v1: https://patch.msgid.link/20261123-double_exception-v1-1-cd82b59a232d@pereq.eu Signed-off-by: Dan Carpenter --- Dan Carpenter (9): KVM: arm64: nv: Use a vcpu request to reprogram the PMU KVM: arm64: Drop an incomplete MMIO access when resetting a vcpu KVM: arm64: Reset SP_EL1, ELR_EL1 and SPSR_EL1 when resetting a vcpu KVM: arm64: Discard a pending SError when resetting a vcpu KVM: arm64: nv: Discard nested SError in kvm_reset_vcpu() KVM: arm64: nv: Replace a pending SError when injecting a new one KVM: arm64: nv: Don't deliver a pending SError to the wrong guest KVM: arm64: nv: Re-inject a stored SError after the exit is handled KVM: arm64: selftests: Test that a vcpu reset clears the vcpu's state arch/arm64/include/asm/kvm_emulate.h | 8 + arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/arm.c | 4 + arch/arm64/kvm/emulate-nested.c | 18 ++- arch/arm64/kvm/inject_fault.c | 10 ++ arch/arm64/kvm/nested.c | 16 +- arch/arm64/kvm/reset.c | 5 + tools/testing/selftests/kvm/Makefile.kvm | 1 + tools/testing/selftests/kvm/arm64/vcpu_reset.c | 211 +++++++++++++++++++++++++ 9 files changed, 262 insertions(+), 12 deletions(-) --- base-commit: adcad7f4e6332cff3d6d7165f41584899f598534 change-id: 20261203-double_exception_v4-b889e07f1911 Best regards, -- Dan Carpenter