From nobody Wed Oct 1 23:34:12 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C24ED13B58C; Fri, 26 Sep 2025 16:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758903805; cv=none; b=Hy+7RzKuWUbNxMHKBWhDHMHXmif0q0nHi2qxNvzK+jGwZMmP30FS7q+0PR1dK/6Exy0ZGvd798VJD+ExmJRe1k1SUdblrdGB1da4CiNZX8JwNtdpLXZj6T+3BVaCo9W/+VH90n8LVLcAArhBCGFdy+Fr0eFnClEmkL/AySmA/vc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758903805; c=relaxed/simple; bh=rYuclI6H2pgLBJCrCodRbO4Nwzob+vO7dbysl+fbkgo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=GjWb+6RpbBw+gat8kCrIdY/MfalB55CoFpvvS7YMbc5AeKNuAoX3FIlQX7ooxn0d5LuMT2/zBXNfq7cxxVdcjAS1pBmESNKEM5FbN5nD6d0NA0RtcbnrL5/RpEMm2TU37DDRhr+sotaZjMCtDLmI8sLaJTHJ+IIHCw05XZy0fD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=k6czJhbJ; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="k6czJhbJ" Received: by linux.microsoft.com (Postfix, from userid 1032) id CD5392124F6D; Fri, 26 Sep 2025 09:23:17 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CD5392124F6D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1758903797; bh=Wjdr5YIOLFpVlaG0LHMyJq1K9oNDoFxiKDO4QpFJ3Ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6czJhbJdCn9sBbY0xXx8d4dlvUpj/qTRWxXMvT2QwSVFVX7tkaApoDwjMdFDsm+C gfzXPs4rBxn+s5CtOLEq1HdGXo1pyVXhuTf5/gNmXgfZU5PGBhu1D20/uMa6HI1G1b og+hs/6Qo3oGVgGxcvGRbyjuZaEim3FwxWMHAMc4= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, prapal@linux.microsoft.com, easwar.hariharan@linux.microsoft.com, tiala@microsoft.com, anirudh@anirudhrb.com, paekkaladevi@linux.microsoft.com, skinsburskii@linux.microsoft.com Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, Nuno Das Neves Subject: [PATCH v4 1/5] mshv: Only map vp->vp_stats_pages if on root scheduler Date: Fri, 26 Sep 2025 09:23:11 -0700 Message-Id: <1758903795-18636-2-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1758903795-18636-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1758903795-18636-1-git-send-email-nunodasneves@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Anirudh Rayabharam Reviewed-by: Praveen K Paladugu Reviewed-by: Easwar Hariharan Reviewed-by: Tianyu Lan Acked-by: Stanislav Kinsburskii --- drivers/hv/mshv_root_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c index e3b2bd417c46..24df47726363 100644 --- a/drivers/hv/mshv_root_main.c +++ b/drivers/hv/mshv_root_main.c @@ -934,7 +934,11 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *= partition, goto unmap_register_page; } =20 - 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 =3D=3D HV_SCHEDULER_TYPE_ROOT) { ret =3D mshv_vp_stats_map(partition->pt_id, args.vp_index, stats_pages); if (ret) @@ -963,7 +967,7 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *p= artition, if (mshv_partition_encrypted(partition) && is_ghcb_mapping_available()) vp->vp_ghcb_page =3D page_to_virt(ghcb_page); =20 - if (hv_parent_partition()) + if (hv_scheduler_type =3D=3D HV_SCHEDULER_TYPE_ROOT) memcpy(vp->vp_stats_pages, stats_pages, sizeof(stats_pages)); =20 /* @@ -986,7 +990,7 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *p= artition, free_vp: kfree(vp); unmap_stats_pages: - if (hv_parent_partition()) + if (hv_scheduler_type =3D=3D 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()) { @@ -1740,7 +1744,7 @@ static void destroy_partition(struct mshv_partition *= partition) if (!vp) continue; =20 - if (hv_parent_partition()) + if (hv_scheduler_type =3D=3D HV_SCHEDULER_TYPE_ROOT) mshv_vp_stats_unmap(partition->pt_id, vp->vp_index); =20 if (vp->vp_register_page) { --=20 2.34.1