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


Groups > linux.kernel > #1478373

Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine

From Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine
Date 2016-09-07 17:00 +0200
Message-ID <seMuu-13P-47@gated-at.bofh.it> (permalink)
References <ses2J-4Ps-3@gated-at.bofh.it> <ses2K-4Ps-31@gated-at.bofh.it> <seJmW-7z9-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016-09-07 13:36:40 [+0200], Borislav Petkov wrote:
> You mean this:
> 
>         /* The CPU refused to come up during a system resume */
>         if (action == CPU_UP_CANCELED_FROZEN)
>                 microcode_fini_cpu(cpu);
correct.
> ?
> 
> It clears internal state, i.e., invalidates the current microcode patch.

it cleans the memory on Intel but not on AMD

> > diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> > index df04b2d033f6..4fc67b51e22e 100644
> > --- a/arch/x86/kernel/cpu/microcode/core.c
> > +++ b/arch/x86/kernel/cpu/microcode/core.c
> 
> ...
> 
> > -static struct notifier_block mc_cpu_notifier = {
> > -	.notifier_call	= mc_cpu_callback,
> > -};
> > +static int mc_cpu_down_prep(unsigned int cpu)
> > +{
> > +	struct device *dev;
> > +
> > +	dev = get_cpu_device(cpu);
> > +	/* Suspend is in progress, only remove the interface */
> > +	sysfs_remove_group(&dev->kobj, &mc_attr_group);
> > +	pr_debug("CPU%d removed\n", cpu);
> > +	return 0;
> > +}
> > +
> > +static int mc_cpu_dead(unsigned int cpu)
> > +{
> > +#ifdef CONFIG_SMP
> > +	if (cpuhp_tasks_frozen)
> > +		microcode_fini_cpu(cpu);
> > +#endif
> > +	return 0;
> > +}
> 
> If this is corresponding to CPU_DEAD, then I'd like to point to that comment:
> 
>         /*
>          * case CPU_DEAD:
>          *
>          * When a CPU goes offline, don't free up or invalidate the copy of
>          * the microcode in kernel memory, so that we can reuse it when the
>          * CPU comes back online without unnecessarily requesting the userspace
>          * for it again.
>          */
> 
> IOW, you don't need mc_cpu_dead().
Okay. After a second look I would say so, too. On Intel we free memory
in this case but we don't set uci->valid back. Which means if the CPU
did not come up after resume we free the memory. If we try it (manually)
again and for some reason the CPU manages to get up, it will end up in
the ONLINE callback with no memory and uci->valid set.

I will prepare a patch with the DEAD state gone.

Sebastian

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


Thread

cpu hotplug: convert more drivers (batch #3) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 20/21] blk: mq: cpu-notif: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 11/21] ACPI: processor: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
    Re: [PATCH 11/21] ACPI: processor: Convert to hotplug state machine "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-06 23:10 +0200
      Re: [PATCH 11/21] ACPI: processor: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 16:10 +0200
        Re: [PATCH 11/21] ACPI: processor: Convert to hotplug state machine "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-07 18:00 +0200
  [PATCH 21/21] blk: mq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 03/21] ARM: OMAP: wakeupgen: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
    Re: [PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine Matt Redfearn <matt.redfearn@imgtec.com> - 2016-09-07 10:30 +0200
      Re: [PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 16:30 +0200
        Re: [PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine Matt Redfearn <matt.redfearn@imgtec.com> - 2016-09-08 10:40 +0200
  [PATCH 04/21] ia64: mca: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 08/21] block: softirq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 06/21] x86: microcode: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
    Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine Borislav Petkov <bp@alien8.de> - 2016-09-07 13:40 +0200
      Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 17:00 +0200
        Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine Borislav Petkov <bp@alien8.de> - 2016-09-07 18:10 +0200
      [PATCH 06/21 v2] x86: microcode: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 18:50 +0200
  [PATCH 14/21] fault-injection: cpu: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 19/21] blk: mq: reserve hotplug ID states for block Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 13/21] padata: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 17/21] s390: mm: pfault: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
    Re: [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-06 20:10 +0200
      Re: [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 16:00 +0200
  [PATCH 16/21] mips: loongson: smp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 12/21] cpufreq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
    Re: [PATCH 12/21] cpufreq: Convert to hotplug state machine "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-06 23:30 +0200
      Re: [PATCH 12/21] cpufreq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-07 16:20 +0200
        Re: [PATCH 12/21] cpufreq: Convert to hotplug state machine "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-07 18:00 +0200
  [PATCH 07/21] lib: irq_poll: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 01/21] arm64: FP/SIMD: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
    Re: [PATCH 01/21] arm64: FP/SIMD: Convert to hotplug state machine Will Deacon <will.deacon@arm.com> - 2016-09-06 20:20 +0200
  [PATCH 05/21] sh: SH-X3 SMP: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 10/21] virtio scsi: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:10 +0200
  [PATCH 09/21] oprofile: timer: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-06 19:20 +0200

csiph-web