From: Babis Chalios <bchalios@amazon.es>
To: <tytso@mit.edu>, <Jason@zx2c4.com>, <linux-kernel@vger.kernel.org>
Cc: <graf@amazon.de>, <mzxreary@0pointer.de>, <xmarcalx@amazon.co.uk>,
<gregkh@linuxfoundation.org>, Babis Chalios <bchalios@amazon.es>
Subject: [PATCH 1/1] vmgenid: emit uevent with new generation ID
Date: Tue, 30 Jul 2024 11:48:31 +0200 [thread overview]
Message-ID: <20240730094831.882166-2-bchalios@amazon.es> (raw)
In-Reply-To: <20240730094831.882166-1-bchalios@amazon.es>
There are many system services that need to be notified when the VM they
are running in is resumed from a snapshot. One example are network
managers which need to renew DHCP leases and/or re-create MAC addresses
for virtual interfaces. Other example are daemons that manage system
clocks which need reset upon snapshot resume.
Send a uevent notification to user space from the VMGenID driver when
we receive the ACPI notification about a new generation ID. This way, we
notify user space software about the VM cloning event and give it a
chance to adapt to the new environment.
Signed-off-by: Babis Chalios <bchalios@amazon.es>
---
drivers/virt/vmgenid.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c
index 66135eac3abff..5410620a017f5 100644
--- a/drivers/virt/vmgenid.c
+++ b/drivers/virt/vmgenid.c
@@ -26,6 +26,7 @@ struct vmgenid_state {
static void vmgenid_notify(struct device *device)
{
struct vmgenid_state *state = device->driver_data;
+ char *envp[] = { "NEW_VMGENID=1", NULL };
u8 old_id[VMGENID_SIZE];
memcpy(old_id, state->this_id, sizeof(old_id));
@@ -33,6 +34,7 @@ static void vmgenid_notify(struct device *device)
if (!memcmp(old_id, state->this_id, sizeof(old_id)))
return;
add_vmfork_randomness(state->this_id, sizeof(state->this_id));
+ kobject_uevent_env(&device->kobj, KOBJ_CHANGE, envp);
}
static void setup_vmgenid_state(struct vmgenid_state *state, void *virt_addr)
--
2.34.1
next prev parent reply other threads:[~2024-07-30 9:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 9:48 [PATCH 0/1] Notify system services about VM clones Babis Chalios
2024-07-30 9:48 ` Babis Chalios [this message]
2024-07-30 11:32 ` [PATCH 1/1] vmgenid: emit uevent with new generation ID Luca Boccassi
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=20240730094831.882166-2-bchalios@amazon.es \
--to=bchalios@amazon.es \
--cc=Jason@zx2c4.com \
--cc=graf@amazon.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mzxreary@0pointer.de \
--cc=tytso@mit.edu \
--cc=xmarcalx@amazon.co.uk \
/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®