From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D98C7329E55 for ; Mon, 26 Jan 2026 09:41:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769420478; cv=none; b=KgDKdPj5fxokDBPIineSFrjqFfdYe0YodJL9S9OCzcPZVDqZitcO+bDgjCG6VW8qcDqLamVlKdCZYpjF8a1yvHkFnTMouvn1x0J9BDhD2yn3f25CirktWrNmPlPBPedJsV8Hm4wkIlP1heJdu3mWvQIYiCX8Mo8xEm15OHWbbaI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769420478; c=relaxed/simple; bh=1C0k9gJ+5oI1N4mcv9s8dt3gMP1eRZworQGDszJ7AEE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=XygxnG+f/iAp/UPlxDE5Wa5WDeIVgOArp+AOKF1J2ZeEF926tAXN5uc24tGpZMHpzzqFpIoHzobGOGFeSqKjS8JVj4dhYd1iHLLlaoJ7NelGzwK6tqAWdOD8s3NsIyzsSagGP5LMoj2zKckW3b1dmZCrgBbepVmalUaf9rLs6xo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=V1RXHIQ5; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=pRSGeP0W; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V1RXHIQ5"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="pRSGeP0W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769420475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o3nUjIOb0Yn17S7L5tMmCjp3A5l9DzXaUcdjJgTeGkw=; b=V1RXHIQ5jCAO8PckWS+VVBIPTp2ESbqy0EUGXnW5FuqVJoznn9ziP/cn8BX+CnW5oiWgNZ 6Bv9rP8MRVPzfpZny53ZlLWyqZWBg3W2YUI5B6ulZ6GNG8n+2PPQ4jyX/yJ3PEHAsTdbU9 4qIKwemSxsFJz4aFw48UELz9ToyjVBU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-375-TVxdNHFOM1-KLMpIp807ow-1; Mon, 26 Jan 2026 04:41:14 -0500 X-MC-Unique: TVxdNHFOM1-KLMpIp807ow-1 X-Mimecast-MFC-AGG-ID: TVxdNHFOM1-KLMpIp807ow_1769420473 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4779d8fd4ecso26255285e9.1 for ; Mon, 26 Jan 2026 01:41:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769420473; x=1770025273; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=o3nUjIOb0Yn17S7L5tMmCjp3A5l9DzXaUcdjJgTeGkw=; b=pRSGeP0WxEv/zkOdwz9fdyDVHQ7MK8cUX0rcdoHZp1vSAuGmaQlidSN3RSlZqH3HkV QOx9DdlUweITo/ePXixb/Ug5jzWlUpCA8pPT3M8OgPPdeAQjZWLNHkGpaTiFfGp2clgC 0edaP85vY9Pt6Bxy7yUPB81yM7bwVN15YnLKH6ZudKzAD0lCDAWUj8U7LSIY9vAMs7Al X8bgkxTgrY8l9t9Rk/mtr4tRuuhBTv3MZfZfYvuzGmcxQDn93DsYZtLx7entRQG/8oSj 0ATTlmio7tyNPV+nUNTJ5/YXiaJuuQkXjzrqwVV4+O4W/T62jSG6icDhCqxBuLybC/i4 7Pkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769420473; x=1770025273; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=o3nUjIOb0Yn17S7L5tMmCjp3A5l9DzXaUcdjJgTeGkw=; b=C8uhhbiHd3gJFGUjl89jmT7KAe/zuXJ20mrtpqH/PK0NAMszt+jqX6VO342Dr+ya1h tp2+Q44EZ2L4w9gOD4Z9Urxz3XAm6ne0wIYgUzof/itpzeXf6biszihX1wpRGezcPSED VkwU9HSQBGyrtVQrp3FzpuJeuD7kBaKdiO0/wR7qMOA2MLq7SzdXb6AJ4SBAcsR4Dcjl EzHWoLUuibiCkbyGBk7cZVGk3WnMgXoBvvXEyrg4y+66CeLmS/c4eu8ijq11vi0x7Jxx pVkR53xApvVXpocOJ9sSQT1aVoZaQRe0OtMESolE0U5IgdiuCWVKFrkShiRVA4JlwPM5 ttNA== X-Forwarded-Encrypted: i=1; AJvYcCW2oTCP9rIKQf6+vgFd30LY2/vLphst4PEllgvU0EaXBrb9WlzNgQqH3Kt5sXzo6rWOFHgZTXTYafYJjUI=@vger.kernel.org X-Gm-Message-State: AOJu0YyqrLG2sGc+4Alu8fCXGFspCjoc6g1j2H5e835BBbo9gGo5CCBU soJpMIHr4XvJ1psoU5m2rjSAR2zv3F6Ioxy661LYu8qSYbnhszlS77eR6L6QahTG07L74Y9ffVg 2c0cFyhKvP7DcYCs018iQRRVsRZeMeq0HvEsx3bwQTzEHMYoxhCI4yGZKBJtCVNtuxA== X-Gm-Gg: AZuq6aKtjyKpb2V5iByoKeDJDFaHcwrzYfEf5jmjYM0TQZiblcwgIxMXKZDsGWbjLAw 2BG1w/tNCp9T4FBOVMGIBlfBDhj+r3ihoO+FO+obvtMh0wydZDTpGoy1MBEOac5GBMYHLrdnDOT A+vElFhlLiY28xaCsOr7bO6Nv/XOKBTzAJ0VclDRU6/5jDT1znj/btNOVqaJwhF6jYKbCISbZ8r ZvUrKwXK5/pm9ytLYsTREkG6kHbC3HnZIKaZOV017d+5EGOVOGeOvecBS7s4Dg8UkmLz3GowVLq wAWuC9HuFJsDZs/JN+Bv9S8Ra0lSA5fV5I01utOpt+oHSvwa3YFwI7WI66fi61I9hOLTAA2K8Se AkQlzDg== X-Received: by 2002:a05:600c:698d:b0:47e:e2b8:66e6 with SMTP id 5b1f17b1804b1-4805ce4fba0mr63757135e9.14.1769420473034; Mon, 26 Jan 2026 01:41:13 -0800 (PST) X-Received: by 2002:a05:600c:698d:b0:47e:e2b8:66e6 with SMTP id 5b1f17b1804b1-4805ce4fba0mr63756705e9.14.1769420472530; Mon, 26 Jan 2026 01:41:12 -0800 (PST) Received: from fedora (g3.ign.cz. [91.219.240.17]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804d5ffe12sm99503345e9.3.2026.01.26.01.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jan 2026 01:41:11 -0800 (PST) From: Vitaly Kuznetsov To: Alexander Graf , Sean Christopherson Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, x86@kernel.org, Paolo Bonzini , nh-open-source@amazon.com, gurugubs@amazon.com, jalliste@amazon.co.uk, Michael Kelley , John Starks Subject: Re: [PATCH] kvm: hyper-v: Delay firing of expired stimers In-Reply-To: <769f538d-dd42-4d36-a4c5-7e6e48b209f6@amazon.com> References: <20260115141520.24176-1-graf@amazon.com> <769f538d-dd42-4d36-a4c5-7e6e48b209f6@amazon.com> Date: Mon, 26 Jan 2026 10:41:10 +0100 Message-ID: <87bjigaeyx.fsf@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Alexander Graf writes: > On 23.01.26 19:21, Sean Christopherson wrote: >> On Thu, Jan 15, 2026, Alexander Graf wrote: >>> During Windows Server 2025 hibernation, I have seen Windows' calculation >>> of interrupt target time get skewed over the hypervisor view of the sam= e. >>> This can cause Windows to emit timer events in the past for events that >>> do not fire yet according to the real time source. This then leads to >>> interrupt storms in the guest which slow down execution to a point where >>> watchdogs trigger. Those manifest as bugchecks 0x9f and 0xa0 during >>> hibernation, typically in the resume path. >>> >>> To work around this problem, we can delay timers that get created with a >>> target time in the past by a tiny bit (10=C2=B5s) to give the guest CPU= time >>> to process real work and make forward progress, hopefully recovering its >>> interrupt logic in the process. While this small delay can marginally >>> reduce accuracy of guest timers, 10=C2=B5s are within the noise of VM >>> entry/exit overhead (~1-2 =C2=B5s) so I do not expect to see real world= impact. >> There is a lot of hope piled into this. And *always* padding the count = makes me >> more than a bit uncomfortable. If the skew is really due to a guest bug= and not >> something on the host's side, i.e. if this isn't just a symptom of a rea= l bug that >> can be fixed and the _only_ option is to chuck in a workaround, then I w= ould >> strongly prefer to be as conservative as possible. E.g. is it possible = to >> precisely detect this scenario and only add the delay when the guest app= ears to >> be stuck? > > > This patch only pads when a timer is in the past, which I have not seen=20 > happen much on real systems. Usually you're trying to configure a timer=20 > for the future :). > > That said, I have continued digging deeper since I posted this patch and= =20 > I'm still trying to wrap my head around under which exact conditions any= =20 > of this really does happen. Let's put this patch on hold until I have a=20 > more reliable reproducer. My bet goes to the clocksource switch, e.g. the guest disables (or just stops using, good luck detecting that :-) ) TSC page and uses raw TSC for some period or something.=20 I remember we had to add some fairly ugly hacks where we also "piled a log of hope", e.g.: commit 0469f2f7ab4c6a6cae4b74c4f981c4da6d909411 Author: Vitaly Kuznetsov Date: Tue Mar 16 15:37:36 2021 +0100 KVM: x86: hyper-v: Don't touch TSC page values when guest opted for re-= enlightenment Also, AFAIR we don't currently implement "Synthetic Time-Unhalted Timer" from TLFS and who knows, maybe Windows' behavior is going to change when we do... --=20 Vitaly