On Thu, Mar 13, 2025 at 3:45 AM Nuno Das Neves <nunodasneves@xxxxxxxxxxxxxxxxxxx> wrote: > > On 3/10/2025 6:01 AM, Tianyu Lan wrote: > > On Thu, Feb 27, 2025 at 7:09 AM Nuno Das Neves > > <nunodasneves@xxxxxxxxxxxxxxxxxxx> wrote: > >> > >> Add a pointer hv_synic_eventring_tail to track the tail pointer for the > >> SynIC event ring buffer for each SINT. > >> > >> This will be used by the mshv driver, but must be tracked independently > >> since the driver module could be removed and re-inserted. > >> > >> Signed-off-by: Nuno Das Neves <nunodasneves@xxxxxxxxxxxxxxxxxxx> > >> Reviewed-by: Wei Liu <wei.liu@xxxxxxxxxx> > > > > It's better to expose a function to check the tail instead of exposing > > hv_synic_eventring_tail directly. > > > What is the advantage of using a function for this? We need to both set > and get the tail. We may add lock or check to avoid race conditions and this depends on the user case. This is why I want to see how mshv driver uses it. > > > BTW, how does mshv driver use hv_synic_eventring_tail? Which patch > > uses it in this series? > > > This variable stores indices into the synic eventring page (one for each > SINT, and per-cpu). Each SINT has a ringbuffer of u32 messages. The tail > index points to the latest one. > > This is only used for doorbell messages today. The message in this case is > a port number which is used to lookup and invoke a callback, which signals > ioeventfd(s), to notify the VMM of a guest MMIO write. > > It is used in patch 10. I found "extern u8 __percpu **hv_synic_eventring_tail;" in the drivers/hv/mshv_root.h of patch 10. I seem to miss the code to use it. +int hv_call_unmap_stat_page(enum hv_stats_object_type type, + const union hv_stats_object_identity *identity); +int hv_call_modify_spa_host_access(u64 partition_id, struct page **pages, + u64 page_struct_count, u32 host_access, + u32 flags, u8 acquire); + +extern struct mshv_root mshv_root; +extern enum hv_scheduler_type hv_scheduler_type; +extern u8 __percpu **hv_synic_eventring_tail; + +#endif /* _MSHV_ROOT_H_ */ -- Thanks Tianyu Lan