From nobody Mon Feb 9 13:36:52 2026 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A86DF2D052 for ; Sat, 18 Jan 2025 00:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737161761; cv=none; b=I/hSdHvhmgeEehmAsYRCpLDXJJ8pkJ/c4oE3tKLkeOu+tSKctoAaJTRvHn1OkviVUMGJIT1e0dbqo0/J0I6EUBDrbdu9BL+KIC8r0lgf1OtIKlSN3R9O7Qd7glRlQaa7Zm+HY1qWocuEtxiJ/5BhPN6EO/IcJzE5nX7UuBSKesc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737161761; c=relaxed/simple; bh=Re6JaOfMeqW7zBx1kUqXmRuRyZAeQXxa2/azIap9LI4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=DsZt22iea+P34VEqqEhvz+z8FOjSbUxVryZhnqSXanJAIeWH4nXHFYEypgUwD1ISWvtxisXNgTgkGZloZPRPrkiV+0qrvzrK+TTzxVbnyyKoSfyCXDlaEHFjZvjVF422Vd2PmMUr1mnQoziGL3MYqQpMSuD6sUrLXt9+PO2bm9g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1AKUcypY; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1AKUcypY" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2efa0eb9dacso5239018a91.1 for ; Fri, 17 Jan 2025 16:55:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1737161759; x=1737766559; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=BWg391tw9c+kOeFxLTnt1zsgTfqyDcOA+e1U4rmehPY=; b=1AKUcypYIc07ODfK/u0JsYMka1Ui6vfk/ecTE8uiRQoNtZEyINbfJYWS83IKhvsKWr +vTf6eexhB4o0W083deUmYWbXIcrP90HVQnc5xGDQiWEQrKlx/yd91xAQN28dG7OGxwg LoF0ZQLkvQPvANBU+VB7bXn2AZAtpsltsIdgfd7hTmRfVAKsnJV/lU40KtDtBvTh8jPc o5EEZ7hZr+RZDG9b4alm8dPTFAXJxu4vJFaMNiebPS4TRWY3fdQ8cLjsPToyYfWJEk0D y77WAC+10S7djittZP0nCQYSZqX4CDiCIUgMjoUFqdcEWPtC4hm5hDJ7DGQ1nL7yGZHo +dRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737161759; x=1737766559; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BWg391tw9c+kOeFxLTnt1zsgTfqyDcOA+e1U4rmehPY=; b=JFanmShJfp3Tf1WDCHTgg4FUSedwLWuZQMQXp7fGwthnGq5WUY6zqui13u1uPM4hiM A8B51qhUkpBoaDR/og6ifCSfGBhgiaERkJCn4bVpsx/bgqVcKYZq1WHbS3dpDOmUZY2h Uq8o4fDqDR4eN7+WtSejHXgIkhiE9leutZ126+Z3aYuVkn0wbFzjpgrJO3EKqof4DwC2 BDM4ShgVEPxYWggzHQWt+KfX04ecwdvRmyUF/6VAoe6GIqkrmKShX0C1mQq4VaR2h4UO K8RYLZve0M1N7BNPRBr58a4YbfPmT0R1EdnzdRxqUDT0gqvPYYlSD2D0m0KfL3e4Lem9 qmYA== X-Forwarded-Encrypted: i=1; AJvYcCXrM6JfmZ145NTUJfrcuDA1Qs4qqD2UVZmhCEm4uXlF5evGMjpfgaPfzQ9DZkumExczoxHJCnf1D4HQFZE=@vger.kernel.org X-Gm-Message-State: AOJu0YxOT5tHwEqZ0OIk+266Zz3W8v+UJA+OZWdGmeOJqFtyYW4Jdeab FW9X3bRu0Zj2mNRAnkAzxR72K5HWhV9NryQx0VVmn1T/vcI1iYHD/mZFumGSdokg7XXQLSnIrZT vOA== X-Google-Smtp-Source: AGHT+IF91N/E24CDCeKFDja0F3kfDaJYkCm4ZjErhAsLwyG21uJ4YMyaWeGoc4lBz6gpAs6skETxGTCOn1E= X-Received: from pjvb5.prod.google.com ([2002:a17:90a:d885:b0:2ea:6b84:3849]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2b8e:b0:2f6:f107:faf8 with SMTP id 98e67ed59e1d1-2f782d2e546mr7359245a91.24.1737161758948; Fri, 17 Jan 2025 16:55:58 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 17 Jan 2025 16:55:44 -0800 In-Reply-To: <20250118005552.2626804-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250118005552.2626804-1-seanjc@google.com> X-Mailer: git-send-email 2.48.0.rc2.279.g1de40edade-goog Message-ID: <20250118005552.2626804-3-seanjc@google.com> Subject: [PATCH 02/10] KVM: x86: Eliminate "handling" of impossible errors during SUSPEND From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , David Woodhouse , Paul Durrant Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+352e553a86e0d75f5120@syzkaller.appspotmail.com, Paul Durrant , David Woodhouse , Vitaly Kuznetsov Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Drop KVM's handling of kvm_set_guest_paused() failure when reacting to a SUSPEND notification, as kvm_set_guest_paused() only "fails" if the vCPU isn't using kvmclock, and KVM's notifier callback pre-checks that kvmclock is active. I.e. barring some bizarre edge case that shouldn't be treated as an error in the first place, kvm_arch_suspend_notifier() can't fail. Signed-off-by: Sean Christopherson Reviewed-by: Paul Durrant --- arch/x86/kvm/x86.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 26e18c9b0375..ef21158ec6b2 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6905,21 +6905,15 @@ static int kvm_arch_suspend_notifier(struct kvm *kv= m) { struct kvm_vcpu *vcpu; unsigned long i; - int ret =3D 0; =20 - kvm_for_each_vcpu(i, vcpu, kvm) { - if (!vcpu->arch.pv_time.active) - continue; + /* + * Ignore the return, marking the guest paused only "fails" if the vCPU + * isn't using kvmclock; continuing on is correct and desirable. + */ + kvm_for_each_vcpu(i, vcpu, kvm) + (void)kvm_set_guest_paused(vcpu); =20 - ret =3D kvm_set_guest_paused(vcpu); - if (ret) { - kvm_err("Failed to pause guest VCPU%d: %d\n", - vcpu->vcpu_id, ret); - break; - } - } - - return ret ? NOTIFY_BAD : NOTIFY_DONE; + return NOTIFY_DONE; } =20 int kvm_arch_pm_notifier(struct kvm *kvm, unsigned long state) --=20 2.48.0.rc2.279.g1de40edade-goog