From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 1183AB666 for ; Sat, 18 Jan 2025 00:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737161757; cv=none; b=gEbu4jtDE5D2qTigZfeJFcW3STgdXk3raLJG3QbOd2YG/kg+6J0f7ZIMLWxCDipkPV1d0dI9T8UMFhSUm/UcEXTGJlySaghr84G77vi/4rFhwmMWEuPaaKRvwdn3G4vJiZhtc4iMvgvN0uFt5OqLpI7yUol5EFjREgT/35n0HKM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737161757; c=relaxed/simple; bh=kp0AvKl0M3EhlVnpqnZc4RZnCT/ITH1XEsY7IrfuuEI=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=Je0vOc53rTqQ6TDGD84LIlCk4BDKoXxksv+TdVjPO3gSUk6idFf0b2aq9SgQ/qJlczGTWGCC4lNm2qxJUVYZxqsYQrllE+gMElX1VSOeZgPvaT+wHruin0i8f9ZZj+9Wi6Wauj7Ll4O/7YpkEG3FuZOS0WSqE4OOa76V4KBaUjc= 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=NHjnhcvn; arc=none smtp.client-ip=209.85.216.74 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="NHjnhcvn" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2ee8ced572eso5334747a91.0 for ; Fri, 17 Jan 2025 16:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1737161755; x=1737766555; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=gsXIfQV2jtjhHOC3156VsAw/0Yaf1d9Hh2AIb0/j5R4=; b=NHjnhcvnrThHJpxJ4dJVEM+VZl73EJ9VJwBatW05r/ovGblwPGmNjK9f1J7Gw+P6rO Os0aQW7wzud6Lr/e3Y8cJXEKoE/twkLAAfsGJxqviBOwxcSxuZcf7Pkw04yqR+IqM3Ru qInXC3RfdatotyrZ5k2WOB81iXoS2bp5Osf2Y21kBaOeRa42lXdWDZ6vxP4Cvfmp3x4o FiWIdZK4XL+h1/LP4EQ+fMwS2Dtq9Yyc5k13u0Uvn0w/uAQWP6zKxhk35w+czQ3dIgkx eGslTsVvSnNhx5blDjm7JVgoNo3Y1nuXzT3kTufBCTSqVzXEAwPvCoW4/W0HRLsDvHNi XAUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737161755; x=1737766555; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gsXIfQV2jtjhHOC3156VsAw/0Yaf1d9Hh2AIb0/j5R4=; b=htsZPwvZzkE6GtuQfrYT6rL56dFZ2hWNfUnK75q90cSGhRCw/Hj5aqeu9FpVRFVJYM TmEip9VEtGsXijD0zjWtpuPt35SYB4R+zvKTYuCr4+gEwRpvlfP41/zfEsbD9P331ELT x6JJdsOXSQwe7pOCSlGc3/EIJHfq0n6/x+Vbq9EtCU25oOOQc+BAc+gsewwGd9OnXGk9 wJLvDLo+7UjRyOPRfPI4RO88Fh0Fsurp9ea69JvT4cUFyZM//rjQCEu8cGhsUoyxa0GO 33BoQaR1GHvESZFbSu2RJ4X006VoVC+yraolKzKVP4vaIJIoh52IPlvPUOVYnDfiH7W4 ZFYw== X-Forwarded-Encrypted: i=1; AJvYcCWM4jBvQIf5WAMSISJC6Ua9sATeqCIvCzrcGIlDc0AHAneNXai3kq7tecKVwaaVh+08wnO3Xk2q6FXbIZI=@vger.kernel.org X-Gm-Message-State: AOJu0YxmhdT3W8RpAbFKIt9XLPee8Mc5yBMIXZfpNzkQhL9c7bowT761 DslQOFbVM7HGsT/uskDphzASLX6H93hySrBtZ/IG13dinF6bz4LvkTm4qcQOFptjHnrwvT9lVBh znQ== X-Google-Smtp-Source: AGHT+IGJvzh6qf8gN83nxEOCJrTaOfX1GeowWxum/Xv+ePnWquKx+q3Z3L0bwhJFvzEv4FakLqUWz87K/rc= X-Received: from pjbsm17.prod.google.com ([2002:a17:90b:2e51:b0:2f4:3ea1:9033]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2741:b0:2ee:c797:e276 with SMTP id 98e67ed59e1d1-2f782afeb20mr8435691a91.0.1737161755408; Fri, 17 Jan 2025 16:55:55 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 17 Jan 2025 16:55:42 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.48.0.rc2.279.g1de40edade-goog Message-ID: <20250118005552.2626804-1-seanjc@google.com> Subject: [PATCH 00/10] KVM: x86: pvclock fixes and cleanups 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-Type: text/plain; charset="UTF-8" Fix a lockdep splat in KVM's suspend notifier by simply removing a spurious kvm->lock acquisition related to kvmclock, and then try to wrangle KVM's pvclock handling into something approaching sanity (I made the mistake of looking at how KVM handled PVCLOCK_GUEST_STOPPED). David, I didn't look too closely to see how this interacts with your overhaul of the pvclock madness[*]. When I first started poking at this, I didn't realize vcpu->arch.hv_lock had tendrils in so many places. Please holler if you want me to drop the vcpu->arch.hv_lock changes and/or tweak something to make it play nice with your series. The Xen changes are *very* lightly tested, so I definitely won't apply the potentially problematic changes, i.e. anything past "Don't bleed PVCLOCK_GUEST_STOPPED across PV clocks", until I get a thumbs up from you and/or Paul. [*] https://lore.kernel.org/all/20240522001817.619072-1-dwmw2@infradead.org Sean Christopherson (10): KVM: x86: Don't take kvm->lock when iterating over vCPUs in suspend notifier KVM: x86: Eliminate "handling" of impossible errors during SUSPEND KVM: x86: Drop local pvclock_flags variable in kvm_guest_time_update() KVM: x86: Set PVCLOCK_GUEST_STOPPED only for kvmclock, not for Xen PV clock KVM: x86: Don't bleed PVCLOCK_GUEST_STOPPED across PV clocks KVM: x86/xen: Use guest's copy of pvclock when starting timer KVM: x86: Pass reference pvclock as a param to kvm_setup_guest_pvclock() KVM: x86: Remove per-vCPU "cache" of its reference pvclock KVM: x86: Setup Hyper-V TSC page before Xen PV clocks (during clock update) KVM: x86: Override TSC_STABLE flag for Xen PV clocks in kvm_guest_time_update() arch/x86/include/asm/kvm_host.h | 3 +- arch/x86/kvm/x86.c | 115 ++++++++++++++++---------------- arch/x86/kvm/xen.c | 62 +++++++++++++++-- 3 files changed, 114 insertions(+), 66 deletions(-) base-commit: eb723766b1030a23c38adf2348b7c3d1409d11f0 -- 2.48.0.rc2.279.g1de40edade-goog