Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1496702

Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs

From Prarit Bhargava <prarit@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs
Date 2016-10-06 17:30 +0200
Message-ID <spiMp-20b-3@gated-at.bofh.it> (permalink)
References <soeUy-7Mb-15@gated-at.bofh.it> <sovLH-1TA-3@gated-at.bofh.it> <sowRr-2BB-1@gated-at.bofh.it> <sozcB-47o-21@gated-at.bofh.it> <soX5f-3e7-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 10/05/2016 12:14 PM, Jiri Olsa wrote:
> On Tue, Oct 04, 2016 at 04:38:16PM +0200, Thomas Gleixner wrote:
>> On Tue, 4 Oct 2016, Prarit Bhargava wrote:
>>> On 10/04/2016 06:58 AM, Thomas Gleixner wrote:
>>>> While it is the right thing to initialize the package map in that case, it
>>>> still papers over a robustness issue in the uncore code, which needs to be
>>>> fixed first.
>>>
>>> I will include a separate patch with an error check for pkg == 0xffff in the
>>> uncore code.
>>
>> 0xffff? That won't help. The id returned is -1 if the entry is not
>> initialized. And aside of that just patching that particular place is not
>> helping as the uncore code and also rapl is relying on the package map
>> being populated.
>>
>> So we need a sanity check in the initialization code which prevents any of
>> this being executed.
> 
> I still need to test this, but how about something like this?
> 
> thanks,
> jirka
> 
> 
> ---
> diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
> index 28865938aadf..61d087a2f25d 100644
> --- a/arch/x86/events/intel/rapl.c
> +++ b/arch/x86/events/intel/rapl.c
> @@ -598,8 +598,13 @@ static int rapl_cpu_online(unsigned int cpu)
>  
>  static int rapl_cpu_prepare(unsigned int cpu)
>  {
> -	struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu);
> +	struct rapl_pmu *pmu;
> +	int pkg = topology_logical_package_id(cpu);
> +
> +	if (WARN_ON(pkg == -1))
> +		return -EINVAL;
>  
> +	pmu = cpu_to_rapl_pmu(cpu);
>  	if (pmu)
>  		return 0;

I thought about doing this but it seems like every time some driver uses
topology_logical_package_id() the driver would have to replicate the error
checking code.

P.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs Prarit Bhargava <prarit@redhat.com> - 2016-10-03 19:10 +0200
  Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs Jiri Olsa <jolsa@redhat.com> - 2016-10-04 00:30 +0200
  Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded  CPUs Thomas Gleixner <tglx@linutronix.de> - 2016-10-04 13:10 +0200
    Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs Prarit Bhargava <prarit@redhat.com> - 2016-10-04 14:20 +0200
      Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded  CPUs Thomas Gleixner <tglx@linutronix.de> - 2016-10-04 16:50 +0200
        Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs Prarit Bhargava <prarit@redhat.com> - 2016-10-04 18:10 +0200
        Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs Jiri Olsa <jolsa@redhat.com> - 2016-10-05 18:20 +0200
          Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs Prarit Bhargava <prarit@redhat.com> - 2016-10-06 17:30 +0200
            Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs Jiri Olsa <jolsa@redhat.com> - 2016-10-07 08:50 +0200
              Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded  CPUs Thomas Gleixner <tglx@linutronix.de> - 2016-10-07 10:10 +0200
    Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded CPUs Jiri Olsa <jolsa@redhat.com> - 2016-10-04 14:30 +0200
      Re: [PATCH] arch/x86: Fix kdump on x86 with physically hotadded  CPUs Thomas Gleixner <tglx@linutronix.de> - 2016-10-04 16:30 +0200
  [tip:x86/urgent] arch/x86: Handle non enumerated CPU after physical  hotplug tip-bot for Prarit Bhargava <tipbot@zytor.com> - 2016-10-07 15:30 +0200

csiph-web