linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Eric DeVolder <eric.devolder@oracle.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	kexec@lists.infradead.org, ebiederm@xmission.com,
	dyoung@redhat.com, vgoyal@redhat.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com, nramas@linux.microsoft.com,
	thomas.lendacky@amd.com, robh@kernel.org, efault@gmx.de,
	rppt@kernel.org, david@redhat.com, konrad.wilk@oracle.com,
	boris.ostrovsky@oracle.com
Subject: Re: [PATCH v6 4/8] crash: add generic infrastructure for crash hotplug support
Date: Wed, 13 Apr 2022 21:24:29 +0800	[thread overview]
Message-ID: <YlbPDedkatzrbWMX@MiWiFi-R3L-srv> (raw)
In-Reply-To: <d3ae80cd-7e1f-50e3-d90d-becf779788c0@oracle.com>

On 04/13/22 at 07:37am, Eric DeVolder wrote:
> 
> 
> On 4/12/22 21:41, Baoquan He wrote:
> > On 04/11/22 at 08:54am, Eric DeVolder wrote:
> > > 
> > > 
> > > On 4/11/22 04:20, Baoquan He wrote:
> > > > Hi Eric,
> > > > 
> > > > On 04/01/22 at 02:30pm, Eric DeVolder wrote:
> > > > ... ...
> > > > 
> > > > > +static void crash_hotplug_handler(unsigned int hp_action,
> > > > > +	unsigned long a, unsigned long b)
> > > > 
> > > > I am still struggling to consider if these unused parameters should be
> > > > kept or removed. Do you foresee or feel on which ARCH they could be used?
> > > > 
> > > > Considering our elfcorehdr updating method, once memory or cpu changed,
> > > > we will update elfcorehdr and cpu notes to reflect all existing memory
> > > > regions and cpu in the current system. We could end up with having them
> > > > but never being used. Then we may finally need to clean them up.
> > > > 
> > > > If you have investigated and foresee or feel they could be used on a
> > > > certain architecture, we can keep them for the time being.
> > > 
> > > So 'hp_action' and 'a' are used within the existing patch series.
> > > In crash_core.c, there is this bit of code:
> > > 
> > > +       kexec_crash_image->offlinecpu =
> > > +           (hp_action == KEXEC_CRASH_HP_REMOVE_CPU) ?
> > > +               (unsigned int)a : ~0U;
> > > 
> > > which is referencing both 'hp_action' and using 'a' from the cpu notifier handler.
> > > I looked into removing 'a' and setting offlinecpu directly, but I thought
> > > it better that offlinecpu be set within the safety of the kexec_mutex.
> > > Also, Sourabh Jain's work with PowerPC utilizing this framework directly
> > > references hp_action in the arch-specific handler.
> > > 
> > > The cpu and memory notifier handlers set hp_action accordingly. For cpu handler,
> > > the 'a' is set with the impacted cpu. For memory handler, 'a' and 'b' form the
> > > impacted memory range. I agree it looks like the memory range is currently
> > > not useful.
> > 
> > OK, memory handler doesn't need the action, memory regions. While cpu
> > handler needs it to exclude the hot plugged cpu.
> > 
> > We could have two ways to acheive this as below. How do you think about
> > them?
> > 
> > static void crash_hotplug_handler(unsigned int hp_action,
> >          unsigned long cpu)
> > 
> > static int crash_memhp_notifier(struct notifier_block *nb,
> >          unsigned long val, void *v)
> > {
> > ......
> >          switch (val) {
> >          case MEM_ONLINE:
> >                  crash_hotplug_handler(KEXEC_CRASH_HP_ADD_MEMORY,
> >                          -1UL);
> >                  break;
> > 
> >          case MEM_OFFLINE:
> >                  crash_hotplug_handler(KEXEC_CRASH_HP_REMOVE_MEMORY,
> >                          -1UL);
> >                  break;
> >          }
> >          return NOTIFY_OK;
> > }
> > 
> > static int crash_cpuhp_online(unsigned int cpu)
> > {
> >          crash_hotplug_handler(KEXEC_CRASH_HP_ADD_CPU, cpu);
> >          return 0;
> > }
> > 
> > static int crash_cpuhp_offline(unsigned int cpu)
> > {
> >          crash_hotplug_handler(KEXEC_CRASH_HP_REMOVE_CPU, cpu);
> >          return 0;
> > }
> 
> I'm OK with the above. Shall I post v7 or are you still looking at patches 7 and 8?
> Thanks!

Just acked patch 8. Patch 7 need be updated too, so will check in v7.

> > 
> > OR,
> > 
> > static void crash_hotplug_handler(unsigned int hp_action,
> >          int* cpu)
> > 
> > static int crash_cpuhp_online(unsigned int cpu)
> > {
> >          crash_hotplug_handler(KEXEC_CRASH_HP_ADD_CPU, NULL);
> >          return 0;
> > }
> > 
> > static int crash_cpuhp_offline(unsigned int cpu)
> > {
> > 	int dead_cpu = cpu;
> >          crash_hotplug_handler(KEXEC_CRASH_HP_REMOVE_CPU, &cpu);
> >          return 0;
> > }
> > 
> 


  reply	other threads:[~2022-04-13 13:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 18:30 [PATCH v6 0/8] crash: Kernel handling of CPU and memory hot un/plug Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 1/8] x86/crash: fix minor typo/bug in debug message Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 2/8] x86/crash: Introduce new options to support cpu and memory hotplug Eric DeVolder
2022-04-08  8:07   ` Baoquan He
2022-04-11 13:54     ` Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 3/8] crash: prototype change for crash_prepare_elf64_headers Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 4/8] crash: add generic infrastructure for crash hotplug support Eric DeVolder
2022-04-11  9:20   ` Baoquan He
2022-04-11 13:54     ` Eric DeVolder
2022-04-13  2:41       ` Baoquan He
2022-04-13 12:37         ` Eric DeVolder
2022-04-13 13:24           ` Baoquan He [this message]
2022-04-01 18:30 ` [PATCH v6 5/8] kexec: exclude elfcorehdr from the segment digest Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 6/8] kexec: exclude hot remove cpu from elfcorehdr notes Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 7/8] x86/crash: Add x86 crash hotplug support for kexec_file_load Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 8/8] x86/crash: Add x86 crash hotplug support for kexec_load Eric DeVolder
2022-04-13 13:13   ` Baoquan He

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=YlbPDedkatzrbWMX@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=efault@gmx.de \
    --cc=eric.devolder@oracle.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nramas@linux.microsoft.com \
    --cc=robh@kernel.org \
    --cc=rppt@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=vgoyal@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).