Skip to content

Commit 9ebc528

Browse files
NunoDasNevesliuw
authored andcommitted
mshv: Only map vp->vp_stats_pages if on root scheduler
This mapping is only used for checking if the dispatch thread is blocked. This is only relevant for the root scheduler, so check the scheduler type to determine whether to map/unmap these pages, instead of the current check, which is incorrect. Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com> Reviewed-by: Anirudh Rayabharam <anirudh@anirudhrb.com> Reviewed-by: Praveen K Paladugu <prapal@linux.microsoft.com> Reviewed-by: Easwar Hariharan <easwar.hariharan@linux.microsoft.com> Reviewed-by: Tianyu Lan <tiala@microsoft.com> Acked-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent 2647c96 commit 9ebc528

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

drivers/hv/mshv_root_main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,11 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *partition,
936936
goto unmap_register_page;
937937
}
938938

939-
if (hv_parent_partition()) {
939+
/*
940+
* This mapping of the stats page is for detecting if dispatch thread
941+
* is blocked - only relevant for root scheduler
942+
*/
943+
if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT) {
940944
ret = mshv_vp_stats_map(partition->pt_id, args.vp_index,
941945
stats_pages);
942946
if (ret)
@@ -965,7 +969,7 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *partition,
965969
if (mshv_partition_encrypted(partition) && is_ghcb_mapping_available())
966970
vp->vp_ghcb_page = page_to_virt(ghcb_page);
967971

968-
if (hv_parent_partition())
972+
if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT)
969973
memcpy(vp->vp_stats_pages, stats_pages, sizeof(stats_pages));
970974

971975
/*
@@ -988,7 +992,7 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *partition,
988992
free_vp:
989993
kfree(vp);
990994
unmap_stats_pages:
991-
if (hv_parent_partition())
995+
if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT)
992996
mshv_vp_stats_unmap(partition->pt_id, args.vp_index);
993997
unmap_ghcb_page:
994998
if (mshv_partition_encrypted(partition) && is_ghcb_mapping_available()) {
@@ -1742,7 +1746,7 @@ static void destroy_partition(struct mshv_partition *partition)
17421746
if (!vp)
17431747
continue;
17441748

1745-
if (hv_parent_partition())
1749+
if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT)
17461750
mshv_vp_stats_unmap(partition->pt_id, vp->vp_index);
17471751

17481752
if (vp->vp_register_page) {

0 commit comments

Comments
 (0)