]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mshv: Only map vp->vp_stats_pages if on root scheduler
authorNuno Das Neves <nunodasneves@linux.microsoft.com>
Fri, 10 Oct 2025 21:55:47 +0000 (14:55 -0700)
committerWei Liu <wei.liu@kernel.org>
Sat, 15 Nov 2025 06:18:15 +0000 (06:18 +0000)
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>
drivers/hv/mshv_root_main.c

index a599bbf1f9b8f7d2d93223114714327c91075e3c..f1fabf52c8f5e59738d958ae9a0180f5a0d38c7e 100644 (file)
@@ -936,7 +936,11 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *partition,
                        goto unmap_register_page;
        }
 
-       if (hv_parent_partition()) {
+       /*
+        * This mapping of the stats page is for detecting if dispatch thread
+        * is blocked - only relevant for root scheduler
+        */
+       if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT) {
                ret = mshv_vp_stats_map(partition->pt_id, args.vp_index,
                                        stats_pages);
                if (ret)
@@ -965,7 +969,7 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *partition,
        if (mshv_partition_encrypted(partition) && is_ghcb_mapping_available())
                vp->vp_ghcb_page = page_to_virt(ghcb_page);
 
-       if (hv_parent_partition())
+       if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT)
                memcpy(vp->vp_stats_pages, stats_pages, sizeof(stats_pages));
 
        /*
@@ -988,7 +992,7 @@ put_partition:
 free_vp:
        kfree(vp);
 unmap_stats_pages:
-       if (hv_parent_partition())
+       if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT)
                mshv_vp_stats_unmap(partition->pt_id, args.vp_index);
 unmap_ghcb_page:
        if (mshv_partition_encrypted(partition) && is_ghcb_mapping_available()) {
@@ -1742,7 +1746,7 @@ static void destroy_partition(struct mshv_partition *partition)
                        if (!vp)
                                continue;
 
-                       if (hv_parent_partition())
+                       if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT)
                                mshv_vp_stats_unmap(partition->pt_id, vp->vp_index);
 
                        if (vp->vp_register_page) {