linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Update PATCH] x86/Hyper-V: Initialize Syn timer clock when it's
@ 2020-03-30 14:17 ltykernel
  2020-03-30 15:09 ` Vitaly Kuznetsov
  2020-04-02 11:21 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: ltykernel @ 2020-03-30 14:17 UTC (permalink / raw)
  To: kys, haiyangz, sthemmin, tglx, mingo, bp, hpa, x86,
	michael.h.kelley, wei.liu
  Cc: Tianyu Lan, devel, linux-kernel, vkuznets

From: Tianyu Lan <Tianyu.Lan@microsoft.com>

Current code initializes clock event data structure for syn timer
even when it's not available. Fix it.

Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
---
- Fix the wrong title.
 
 drivers/hv/hv.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 632d25674e7f..2e893768fc76 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -212,13 +212,16 @@ int hv_synic_alloc(void)
 		tasklet_init(&hv_cpu->msg_dpc,
 			     vmbus_on_msg_dpc, (unsigned long) hv_cpu);
 
-		hv_cpu->clk_evt = kzalloc(sizeof(struct clock_event_device),
-					  GFP_KERNEL);
-		if (hv_cpu->clk_evt == NULL) {
-			pr_err("Unable to allocate clock event device\n");
-			goto err;
+		if (ms_hyperv.features & HV_MSR_SYNTIMER_AVAILABLE) {
+			hv_cpu->clk_evt =
+				kzalloc(sizeof(struct clock_event_device),
+						  GFP_KERNEL);
+			if (hv_cpu->clk_evt == NULL) {
+				pr_err("Unable to allocate clock event device\n");
+				goto err;
+			}
+			hv_init_clockevent_device(hv_cpu->clk_evt, cpu);
 		}
-		hv_init_clockevent_device(hv_cpu->clk_evt, cpu);
 
 		hv_cpu->synic_message_page =
 			(void *)get_zeroed_page(GFP_ATOMIC);
-- 
2.14.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Update PATCH] x86/Hyper-V: Initialize Syn timer clock when it's
  2020-03-30 14:17 [Update PATCH] x86/Hyper-V: Initialize Syn timer clock when it's ltykernel
@ 2020-03-30 15:09 ` Vitaly Kuznetsov
  2020-03-31  1:47   ` Tianyu Lan
  2020-04-02 11:21 ` Dan Carpenter
  1 sibling, 1 reply; 5+ messages in thread
From: Vitaly Kuznetsov @ 2020-03-30 15:09 UTC (permalink / raw)
  To: ltykernel
  Cc: Tianyu Lan, devel, linux-kernel, kys, haiyangz, sthemmin, tglx,
	mingo, bp, hpa, x86, michael.h.kelley, wei.liu

ltykernel@gmail.com writes:

> From: Tianyu Lan <Tianyu.Lan@microsoft.com>
>
> Current code initializes clock event data structure for syn timer
> even when it's not available. Fix it.
>
> Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
> ---
> - Fix the wrong title.

The new one is ... weird too :-)

I think it was supposed to be something like "x86/Hyper-V: don't
allocate clockevent device when synthetic timer is unavailable"

>  
>  drivers/hv/hv.c | 15 +++++++++------

Which tree is this patch for? Upstream clockevent allocation has moved
to drivers/clocksource/hyperv_timer.c 

>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 632d25674e7f..2e893768fc76 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -212,13 +212,16 @@ int hv_synic_alloc(void)
>  		tasklet_init(&hv_cpu->msg_dpc,
>  			     vmbus_on_msg_dpc, (unsigned long) hv_cpu);
>  
> -		hv_cpu->clk_evt = kzalloc(sizeof(struct clock_event_device),
> -					  GFP_KERNEL);
> -		if (hv_cpu->clk_evt == NULL) {
> -			pr_err("Unable to allocate clock event device\n");
> -			goto err;
> +		if (ms_hyperv.features & HV_MSR_SYNTIMER_AVAILABLE) {
> +			hv_cpu->clk_evt =
> +				kzalloc(sizeof(struct clock_event_device),
> +						  GFP_KERNEL);
> +			if (hv_cpu->clk_evt == NULL) {
> +				pr_err("Unable to allocate clock event device\n");
> +				goto err;
> +			}
> +			hv_init_clockevent_device(hv_cpu->clk_evt, cpu);
>  		}
> -		hv_init_clockevent_device(hv_cpu->clk_evt, cpu);
>  
>  		hv_cpu->synic_message_page =
>  			(void *)get_zeroed_page(GFP_ATOMIC);

-- 
Vitaly


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Update PATCH] x86/Hyper-V: Initialize Syn timer clock when it's
  2020-03-30 15:09 ` Vitaly Kuznetsov
@ 2020-03-31  1:47   ` Tianyu Lan
  0 siblings, 0 replies; 5+ messages in thread
From: Tianyu Lan @ 2020-03-31  1:47 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: Tianyu Lan, devel, linux-kernel, kys, haiyangz, sthemmin, tglx,
	mingo, bp, hpa, x86, michael.h.kelley, wei.liu

Hi Vitaly:
     Thanks for your review.

On 3/30/2020 11:09 PM, Vitaly Kuznetsov wrote:
> ltykernel@gmail.com writes:
> 
>> From: Tianyu Lan <Tianyu.Lan@microsoft.com>
>>
>> Current code initializes clock event data structure for syn timer
>> even when it's not available. Fix it.
>>
>> Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
>> ---
>> - Fix the wrong title.
> 
> The new one is ... weird too :-)
> 
> I think it was supposed to be something like "x86/Hyper-V: don't
> allocate clockevent device when synthetic timer is unavailable"

Good suggestion. Will update in the next version.
> 
>>   
>>   drivers/hv/hv.c | 15 +++++++++------
> 
> Which tree is this patch for? Upstream clockevent allocation has moved
> to drivers/clocksource/hyperv_timer.c
> 
>>   1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
>> index 632d25674e7f..2e893768fc76 100644
>> --- a/drivers/hv/hv.c
>> +++ b/drivers/hv/hv.c
>> @@ -212,13 +212,16 @@ int hv_synic_alloc(void)
>>   		tasklet_init(&hv_cpu->msg_dpc,
>>   			     vmbus_on_msg_dpc, (unsigned long) hv_cpu);
>>   
>> -		hv_cpu->clk_evt = kzalloc(sizeof(struct clock_event_device),
>> -					  GFP_KERNEL);
>> -		if (hv_cpu->clk_evt == NULL) {
>> -			pr_err("Unable to allocate clock event device\n");
>> -			goto err;
>> +		if (ms_hyperv.features & HV_MSR_SYNTIMER_AVAILABLE) {
>> +			hv_cpu->clk_evt =
>> +				kzalloc(sizeof(struct clock_event_device),
>> +						  GFP_KERNEL);
>> +			if (hv_cpu->clk_evt == NULL) {
>> +				pr_err("Unable to allocate clock event device\n");
>> +				goto err;
>> +			}
>> +			hv_init_clockevent_device(hv_cpu->clk_evt, cpu);
>>   		}
>> -		hv_init_clockevent_device(hv_cpu->clk_evt, cpu);
>>   
>>   		hv_cpu->synic_message_page =
>>   			(void *)get_zeroed_page(GFP_ATOMIC);
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Update PATCH] x86/Hyper-V: Initialize Syn timer clock when it's
  2020-03-30 14:17 [Update PATCH] x86/Hyper-V: Initialize Syn timer clock when it's ltykernel
  2020-03-30 15:09 ` Vitaly Kuznetsov
@ 2020-04-02 11:21 ` Dan Carpenter
  2020-04-02 12:30   ` Tianyu Lan
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2020-04-02 11:21 UTC (permalink / raw)
  To: ltykernel
  Cc: kys, haiyangz, sthemmin, tglx, mingo, bp, hpa, x86,
	michael.h.kelley, wei.liu, devel, vkuznets, Tianyu Lan,
	linux-kernel

This doesn't apply to today's linux-next.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Update PATCH] x86/Hyper-V: Initialize Syn timer clock when it's
  2020-04-02 11:21 ` Dan Carpenter
@ 2020-04-02 12:30   ` Tianyu Lan
  0 siblings, 0 replies; 5+ messages in thread
From: Tianyu Lan @ 2020-04-02 12:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kys, haiyangz, sthemmin, tglx, mingo, bp, hpa, x86,
	michael.h.kelley, wei.liu, devel, vkuznets, Tianyu Lan,
	linux-kernel

Hi Dan:
     Sorry. Please ignore this patch and it's based on the old code.

On 4/2/2020 7:21 PM, Dan Carpenter wrote:
> This doesn't apply to today's linux-next.
> 
> regards,
> dan carpenter
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-02 12:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 14:17 [Update PATCH] x86/Hyper-V: Initialize Syn timer clock when it's ltykernel
2020-03-30 15:09 ` Vitaly Kuznetsov
2020-03-31  1:47   ` Tianyu Lan
2020-04-02 11:21 ` Dan Carpenter
2020-04-02 12:30   ` Tianyu Lan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).