lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e7f35b68-b1c1-4c9a-885f-57440fce8397@linux.microsoft.com>
Date:   Wed, 16 Aug 2023 14:40:21 -0700
From:   Nuno Das Neves <nunodasneves@...ux.microsoft.com>
To:     Wei Liu <wei.liu@...nel.org>
Cc:     linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org,
        x86@...nel.org, linux-arm-kernel@...ts.infradead.org,
        linux-arch@...r.kernel.org, mikelley@...rosoft.com,
        kys@...rosoft.com, haiyangz@...rosoft.com, decui@...rosoft.com,
        ssengar@...ux.microsoft.com, mukeshrathor@...rosoft.com,
        stanislav.kinsburskiy@...il.com, jinankjain@...ux.microsoft.com,
        apais@...ux.microsoft.com, Tianyu.Lan@...rosoft.com,
        vkuznets@...hat.com, tglx@...utronix.de, mingo@...hat.com,
        bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
        will@...nel.org, catalin.marinas@....com
Subject: Re: [PATCH 08/15] Drivers: hv: Introduce per-cpu event ring tail

>> +/*
>> + * Per-cpu array holding the tail pointer for the SynIC event ring buffer
>> + * for each SINT.
>> + *
>> + * We cannot maintain this in mshv driver because the tail pointer should
>> + * persist even if the mshv driver is unloaded.
>> + */
>> +u8 __percpu **hv_synic_eventring_tail;
>> +EXPORT_SYMBOL_GPL(hv_synic_eventring_tail);
>> +
>>  /*
>>   * Hyper-V specific initialization and shutdown code that is
>>   * common across all architectures.  Called from architecture
>> @@ -332,6 +342,8 @@ int __init hv_common_init(void)
>>  	if (hv_root_partition) {
>>  		hyperv_pcpu_output_arg = alloc_percpu(void *);
>>  		BUG_ON(!hyperv_pcpu_output_arg);
>> +		hv_synic_eventring_tail = alloc_percpu(u8 *);
>> +		BUG_ON(hv_synic_eventring_tail == NULL);
>>  	}
>>  
>>  	hv_vp_index = kmalloc_array(num_possible_cpus(), sizeof(*hv_vp_index),
>> @@ -356,6 +368,7 @@ int __init hv_common_init(void)
>>  int hv_common_cpu_init(unsigned int cpu)
>>  {
>>  	void **inputarg, **outputarg;
>> +	u8 **synic_eventring_tail;
>>  	u64 msr_vp_index;
>>  	gfp_t flags;
>>  	int pgcount = hv_root_partition ? 2 : 1;
>> @@ -371,6 +384,14 @@ int hv_common_cpu_init(unsigned int cpu)
>>  	if (hv_root_partition) {
>>  		outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg);
>>  		*outputarg = (char *)(*inputarg) + HV_HYP_PAGE_SIZE;
>> +		synic_eventring_tail = (u8 **)this_cpu_ptr(hv_synic_eventring_tail);
>> +		*synic_eventring_tail = kcalloc(HV_SYNIC_SINT_COUNT, sizeof(u8),
>> +						flags);
>> +
>> +		if (unlikely(!*synic_eventring_tail)) {
>> +			kfree(*inputarg);
>> +			return -ENOMEM;
>> +		}
>>  	}
>>  
>>  	msr_vp_index = hv_get_register(HV_MSR_VP_INDEX);
>> @@ -387,6 +408,7 @@ int hv_common_cpu_die(unsigned int cpu)
>>  {
>>  	unsigned long flags;
>>  	void **inputarg, **outputarg;
>> +	u8 **synic_eventring_tail;
>>  	void *mem;
>>  
>>  	local_irq_save(flags);
>> @@ -398,6 +420,9 @@ int hv_common_cpu_die(unsigned int cpu)
>>  	if (hv_root_partition) {
>>  		outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg);
>>  		*outputarg = NULL;
>> +		synic_eventring_tail = (u8 **)this_cpu_ptr(hv_synic_eventring_tail);
>> +		kfree(*synic_eventring_tail);
>> +		*synic_eventring_tail = NULL;
> 
> The upstream code looks different now. See 9636be85cc.
> 
Thanks, I have rebased for v2, and fixed this.

>>  	}
>>  
>>  	local_irq_restore(flags);
>> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
>> index 0c94d20b4d44..9118d678b27a 100644
>> --- a/include/asm-generic/mshyperv.h
>> +++ b/include/asm-generic/mshyperv.h
>> @@ -73,6 +73,8 @@ extern bool hv_nested;
>>  extern void * __percpu *hyperv_pcpu_input_arg;
>>  extern void * __percpu *hyperv_pcpu_output_arg;
>>  
>> +extern u8 __percpu **hv_synic_eventring_tail;
>> +
>>  extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr);
>>  extern u64 hv_do_fast_hypercall8(u16 control, u64 input8);
>>  extern bool hv_isolation_type_snp(void);
>> -- 
>> 2.25.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ