All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, mst@redhat.com, eauger@redhat.com,
	shannon.zhaosl@gmail.com, rad@semihalf.com,
	leif.lindholm@oss.qualcomm.com, qemu-arm@nongnu.org
Subject: Re: [PATCH v3 17/17] sbsa-gwdt: limit compare_value to INT64_MAX
Date: Tue, 30 Jun 2026 14:14:47 +0200	[thread overview]
Message-ID: <20260630141447.7cc20ba0@imammedo> (raw)
In-Reply-To: <CAFEAcA8DzTCP_z9mkHK7QHwMvk8bVb1z7mtN80MsYOZ49ZPx3w@mail.gmail.com>

On Mon, 29 Jun 2026 15:48:48 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:

> On Wed, 24 Jun 2026 at 11:29, Igor Mammedov <imammedo@redhat.com> wrote:
> >
> > QEMU timer subsystem uses int64_t, so WCV values with bit 63 set
> > overflow and cause the timer to fire immediately. The SBSA spec
> > defines WCV as an unsigned 64-bit compare value, so such values
> > are valid per spec and represent far-future deadlines (however
> > unpractical).
> >
> > Windows in GTDT mode writes WCV in two 32-bit halves while the
> > watchdog is running:
> >
> >  sbsa-gwdt_control_write [0x8]  <- 0xffffffff    # WOR (~4 sec)
> >  sbsa-gwdt_control_write [0x0]  <- 0x1           # WCS enable
> >  sbsa-gwdt_control_write [0x14] <- 0xffffffff    # WCVU (intermediate)
> >  sbsa-gwdt_control_write [0x10] <- 0xa906ca28    # WCVL
> >  sbsa-gwdt_control_write [0x14] <- 0xecb1        # WCVU (final)
> >
> > The intermediate WCVU write (0xffffffff) creates a WCV above
> > INT64_MAX, which overflows QEMU's signed timer and fires
> > immediately — triggering WS0 => WS1 => reboot before the final
> > WCVU write lands.
> >
> > Clamp WCV to INT64_MAX to avoid timer API overflow.  
> 
> This bug doesn't exist as described in the current upstream
> version of this device, because we don't use WCVU/WCVL in
> calculating the timeout (only WORU/WORL, which are forced to
> 48 bits wide on write). This suggests that either you have
> introduced it in this series, in which case it would be better
> to not do that, or else that it exists in a different form
> in current upstream, in which case it would be better to
> fix it first in the patchset, so it can be cc:stable for
> backports.

it's masked by missing timer reschedule on WCV update,
that preceding patch #16 fixes.
So yes it's ordering issue.

perhaps it's better split this patches into independed series,
given that the last 14-17 patches are fixing native GWDT
behavior for Windows usecase (which would still not work
due to too large timeouts)
and that it's not directly related to this series (linux uses
normal refresh approach with native gwdt mode), and WDAT mode
peddled by this series work fine with both Windows and Linux.

With the last 4 patches we still need to convince MS to fix large
timeouts on their side to make native gwdt work as expected.


> 
> thanks
> -- PMM
> 



      reply	other threads:[~2026-06-30 12:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 10:28 [PATCH v3 00/17] Add watchdog support to arm/virt board Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 01/17] arm: sbsa_gwdt: fixup default "clock-frequency" Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 02/17] arm: add tracing events to sbsa_gwdt Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 03/17] arm: sbsa_gwdt: rename device type to sbsa-gwdt Igor Mammedov
2026-06-29  8:12   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 04/17] arm: virt: create sbsa-gwdt watchdog Igor Mammedov
2026-06-29  8:37   ` Eric Auger
2026-06-29 13:36     ` Igor Mammedov
2026-07-01 11:57       ` Eric Auger
2026-07-01 13:24         ` Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 05/17] arm: sbsa-gwdt: add 'wdat' option Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 06/17] acpi: introduce WDAT table for GWDT Igor Mammedov
2026-06-29 12:07   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 07/17] arm: virt: add support for WDAT based watchdog Igor Mammedov
2026-06-29 12:15   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 08/17] tests: acpi: arm/virt: whitelist new WDAT table Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 09/17] tests: acpi: arm/virt: add WDAT table test case Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 10/17] tests: acpi: arm/virt: update expected WDAT blob Igor Mammedov
2026-06-29 12:16   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 11/17] tests: acpi: arm/virt: whitelist GTDT table Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 12/17] tests: acpi: arm/virt: add GTDT watchdog table test case Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 13/17] tests: acpi: arm/virt: update expected GTDT blob Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 14/17] sbsa-gwdt: reduce code ident Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 15/17] sbsa-gwdt: move all foo_REFRESH logic under REFRESH condition Igor Mammedov
2026-06-29 14:03   ` Eric Auger
2026-06-29 14:51   ` Peter Maydell
2026-06-24 10:28 ` [PATCH v3 16/17] sbsa-gwdt: reschedule timer on direct WCV load Igor Mammedov
2026-06-29 14:08   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 17/17] sbsa-gwdt: limit compare_value to INT64_MAX Igor Mammedov
2026-06-29 14:10   ` Eric Auger
2026-06-29 14:48   ` Peter Maydell
2026-06-30 12:14     ` Igor Mammedov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260630141447.7cc20ba0@imammedo \
    --to=imammedo@redhat.com \
    --cc=eauger@redhat.com \
    --cc=leif.lindholm@oss.qualcomm.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rad@semihalf.com \
    --cc=shannon.zhaosl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.