The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Mukesh R <mrathor@linux.microsoft.com>
To: Michael Kelley <mhklinux@outlook.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Linux on Hyper-V List <linux-hyperv@vger.kernel.org>
Cc: "mukeshrathor@linux.microsoft.com"
	<mukeshrathor@linux.microsoft.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>, Long Li <longli@microsoft.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/hyperv: reserve more vectors
Date: Mon, 10 Aug 2026 12:03:32 -0700	[thread overview]
Message-ID: <74f2ef45-9fc5-2df2-832d-dbbf5f30885f@linux.microsoft.com> (raw)
In-Reply-To: <SN6PR02MB41579785497E4D4FC62A95E0D4DE2@SN6PR02MB4157.namprd02.prod.outlook.com>

On 8/10/26 08:35, Michael Kelley wrote:
> From: wei.liu@kernel.org <wei.liu@kernel.org> Sent: Wednesday, July 29, 2026 5:50 PM
>>
>> Microsoft Hypervisor delivers three vectors to the NT HAL running in the
>> root partition and refuses to map a device interrupt to any of them when
>> interrupt remapping is not available in the system. As of writing, the
> 
> s/of writing/of this writing/
> 
>> nested MSHV setup has no interrupt remapping capability.
>>
>> The three vectors are:
>>
>>    HAL_NT_APC_VECTOR		0x1F
>>    HAL_NT_DPC_VECTOR		0x2F
>>    HAL_NT_CLOCK_IPI_VECTOR	0xD2
>>
>> 0x1F is below FIRST_EXTERNAL_VECTOR so the vector allocator never hands
>> it out, but 0x2F and 0xD2 are both inside the allocatable range and are
>> handed out once enough vectors are in use. Mapping such an interrupt
>> then fails with HV_STATUS_INVALID_PARAMETER, and the interrupt is never
>> delivered.
>>
>> Reserve all three next to the hypervisor debug vectors that are already
>> kept out of the allocator's hands.
>>
>> Signed-off-by: Wei Liu <wei.liu@kernel.org>
>> ---
>>   arch/x86/kernel/cpu/mshyperv.c | 21 ++++++++++++++++++---
>>   1 file changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
>> index 185d4f677ec0..229c7377a980 100644
>> --- a/arch/x86/kernel/cpu/mshyperv.c
>> +++ b/arch/x86/kernel/cpu/mshyperv.c
>> @@ -502,17 +502,32 @@ static void hv_reserve_irq_vectors(void)
>>   	#define HYPERV_DBG_ASSERT_VECTOR	0x2C
>>   	#define HYPERV_DBG_SERVICE_VECTOR	0x2D
>>
>> +	/*
>> +	 * The hypervisor delivers these three to the NT HAL and refuses to
>> +	 * map a device interrupt to any of them.
>> +	 *
>> +	 * The hypervisor will provide a hint in the future when these
>> +	 * vectors become available to use.
>> +	 */
>> +	#define HAL_NT_APC_VECTOR		0x1F
>> +	#define HAL_NT_DPC_VECTOR		0x2F
>> +	#define HAL_NT_CLOCK_IPI_VECTOR		0xD2
>> +
>>   	if (cpu_feature_enabled(X86_FEATURE_FRED))
>>   		return;
>>
>>   	if (test_and_set_bit(HYPERV_DBG_ASSERT_VECTOR, system_vectors) ||
>>   	    test_and_set_bit(HYPERV_DBG_SERVICE_VECTOR, system_vectors) ||
>> -	    test_and_set_bit(HYPERV_DBG_FASTFAIL_VECTOR, system_vectors))
>> +	    test_and_set_bit(HYPERV_DBG_FASTFAIL_VECTOR, system_vectors) ||
>> +	    test_and_set_bit(HAL_NT_APC_VECTOR, system_vectors) ||
>> +	    test_and_set_bit(HAL_NT_DPC_VECTOR, system_vectors) ||
>> +	    test_and_set_bit(HAL_NT_CLOCK_IPI_VECTOR, system_vectors))
> 
> Calling test_and_set_bit() explicitly for each of the 6 vectors seems right
> on the border of where it would be better to declare a static array with
> the vectors and loop through the array. The loop could also populate the
> string to be output in the pr_info() statement below. But leaving it explicit
> as you have done is probably simpler unless the vector list grows again.

Simpler and better imo, but moreover, we want to discourage the
list enlarging, if anything, i hope going forward we can shrink it
back to absolutely minimum.

Thanks,
-Mukesh


> Reviewed-by: Michael Kelley <mhklinux@outlook.com>
> 
>>   		BUG();
>>
>> -	pr_info("Hyper-V: reserve vectors: 0x%x 0x%x 0x%x\n",
>> +	pr_info("Hyper-V: reserve vectors: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
>>   		HYPERV_DBG_ASSERT_VECTOR, HYPERV_DBG_SERVICE_VECTOR,
>> -		HYPERV_DBG_FASTFAIL_VECTOR);
>> +		HYPERV_DBG_FASTFAIL_VECTOR, HAL_NT_APC_VECTOR,
>> +		HAL_NT_DPC_VECTOR, HAL_NT_CLOCK_IPI_VECTOR);
>>   }
>>
>>   static void __init ms_hyperv_init_platform(void)
>> --
>> 2.53.0
>>
> 


      reply	other threads:[~2026-08-10 19:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  0:50 [PATCH] x86/hyperv: reserve more vectors wei.liu
2026-08-10 15:35 ` Michael Kelley
2026-08-10 19:03   ` Mukesh R [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74f2ef45-9fc5-2df2-832d-dbbf5f30885f@linux.microsoft.com \
    --to=mrathor@linux.microsoft.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=mhklinux@outlook.com \
    --cc=mingo@redhat.com \
    --cc=mukeshrathor@linux.microsoft.com \
    --cc=tglx@kernel.org \
    --cc=wei.liu@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox