> From: Michael Kelley <mhklinux@xxxxxxxxxxx> > Sent: Tuesday, October 29, 2024 4:45 PM > [...] > An alternate approach occurs to me. util_probe() does these three > things in order: > > 1) Allocates the receive buffer > 2) Calls the util_init() function, which for KVP and VSS creates the char dev > 3) Sets up the VMBus channel, including calling vmbus_open() > > What if the order of #2 and #3 were swapped in util_probe()? I > don't immediately see any interdependency between #2 and #3 > for KVP and VSS, nor for Shutdown and Timesync. With the swap, > the VMBus channel would be fully open by the time the /dev entry > appears and the user space daemon can do anything. > > I haven't though too deeply about this, so maybe there's a problem > somewhere. But if not, it seems a lot cleaner. > > Michael I think #3 depends on #2, e.g. hv_kvp_init() sets the channel's preferred max_pkt_size, which is tested later in __vmbus_open(). Another example of dependency is: hv_timesync_init() initializes host_ts.lock and adj_time_work, which are used by timesync_onchannelcallback() -> adj_guesttime(). Note: the channel callback can be already running before vmbus_open() returns. Thanks, Dexuan