From: Hans de Goede <hansg@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, arnd@arndb.de
Cc: linux-kernel@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
stable <stable@kernel.org>
Subject: Re: [PATCH] virt: vboxguest: send the heartbeat at the interval
Date: Tue, 27 Oct 2026 17:41:33 +0100 [thread overview]
Message-ID: <f0ea8b30-681f-47bb-aa37-02945dc77d2b@kernel.org> (raw)
In-Reply-To: <2026102758-grime-danger-9fb4@gregkh>
Hi,
On 27-Oct-26 17:34, Greg Kroah-Hartman wrote:
> From: Josef Bacik <josef@toxicpanda.com>
>
> The host tells the guest how often it expects a heartbeat.
> vbg_heartbeat_timer() re-arms its timer with
>
> mod_timer(&gdev->heartbeat_timer, msecs_to_jiffies(interval));
>
> But the second argument of mod_timer() is a point in time, not a delay.
> An interval, taken as a point in time, lies in the past, so the timer
> expires again on the next tick. Whatever the host has asked for, the
> guest sends a heartbeat 100 to 1000 times a second, depending on HZ, and
> each of them is a request to the host, that is a VM exit from the timer
> softirq.
>
> On 32 bit, where jiffies starts five minutes before it wraps around,
> these small values lie in the future at first. That also goes for the 0
> with which vbg_heartbeat_init() means to start the timer at once: if the
> driver is loaded during boot, the first heartbeat is only sent five
> minutes after boot.
>
> Add jiffies in both places. Every VirtualBox guest now sends its
> heartbeat at the interval which the host has asked for.
>
> Fixes: 0ba002bc4393 ("virt: Add vboxguest driver for Virtual Box Guest integration")
> Cc: stable <stable@kernel.org>
> Cc: Hans de Goede <hansg@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Regards,
Hans
> ---
> drivers/virt/vboxguest/vboxguest_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c
> index b5dc0d01facd..be6a8cc4e712 100644
> --- a/drivers/virt/vboxguest/vboxguest_core.c
> +++ b/drivers/virt/vboxguest/vboxguest_core.c
> @@ -422,7 +422,7 @@ static void vbg_heartbeat_timer(struct timer_list *t)
>
> vbg_req_perform(gdev, gdev->guest_heartbeat_req);
> mod_timer(&gdev->heartbeat_timer,
> - msecs_to_jiffies(gdev->heartbeat_interval_ms));
> + jiffies + msecs_to_jiffies(gdev->heartbeat_interval_ms));
> }
>
> /**
> @@ -482,7 +482,7 @@ static int vbg_heartbeat_init(struct vbg_dev *gdev)
>
> vbg_info("%s: Setting up heartbeat to trigger every %d milliseconds\n",
> __func__, gdev->heartbeat_interval_ms);
> - mod_timer(&gdev->heartbeat_timer, 0);
> + mod_timer(&gdev->heartbeat_timer, jiffies);
>
> return 0;
> }
prev parent reply other threads:[~2026-10-27 16:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 16:34 Greg Kroah-Hartman
2026-10-27 16:41 ` Hans de Goede [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=f0ea8b30-681f-47bb-aa37-02945dc77d2b@kernel.org \
--to=hansg@kernel.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=josef@toxicpanda.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®