From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2A63303A31; Fri, 10 Oct 2025 21:55:54 +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=1760133356; cv=none; b=kO423dSHwqrvYh6+W1R0aVKgi47b1GS0Q2yp+x8+0dM0l57VlGg1CCA1CFTCZwaDTlVU6B6+sy6Hf/1Ipz+8oGUpvC+s7Ej1HZSHnxGFxwwyLct8WgySTs4sB36WHW2KV8r5vtTinc333q/jDqbwwNhXefPWKAH24uxCtZ16thE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760133356; c=relaxed/simple; bh=rYuclI6H2pgLBJCrCodRbO4Nwzob+vO7dbysl+fbkgo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=N0u0gUMoh40BfR2ITGsKGQAAL7IS3aXFiEHV4iyehzPhPKAWJNCctBhdEefby7trXkVlTO/MVfagVvrUqQMXr5AFLLklIIEgjtRNXZrsJVekJ42tcqhxWRps/8nAHVHVsBKZmjOmICBL/q8MWZ6Oh9tou5KhRpCEeRzikP8MNvk= 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=UhlKn64F; 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="UhlKn64F" Received: by linux.microsoft.com (Postfix, from userid 1032) id 7862B2038B68; Fri, 10 Oct 2025 14:55:54 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7862B2038B68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1760133354; bh=Wjdr5YIOLFpVlaG0LHMyJq1K9oNDoFxiKDO4QpFJ3Ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UhlKn64F7bBFoISYeuGXC3FBQwHrOsmRVAJF0jRYisDCM0fh1YTtqXhAn6WVyP4yF IcxT/u5NkOSe+lp5fs9mVv/rpOX3vZ2hoWyo+rVhqDFszDBKWo7i6qyGGs/4hsGKjg BpH6Zg8KdsZTKR9q1Y2KY523iGAyZKVrPwrU1c9E= 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, mhklinux@outlook.com Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, Nuno Das Neves Subject: [PATCH v5 1/5] mshv: Only map vp->vp_stats_pages if on root scheduler Date: Fri, 10 Oct 2025 14:55:47 -0700 Message-Id: <1760133351-6643-2-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1760133351-6643-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1760133351-6643-1-git-send-email-nunodasneves@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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; } - 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) @@ -963,7 +967,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)); /* @@ -986,7 +990,7 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *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()) { @@ -1740,7 +1744,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) { -- 2.34.1