From: Balbir Singh <bsingharora@gmail.com>
To: Mahesh Jagannath Salgaonkar <mahesh@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
linuxppc-dev <linuxppc-dev@ozlabs.org>
Cc: Hari Bathini <hbathini@linux.vnet.ibm.com>,
Haren Myneni <hbabu@us.ibm.com>,
Anton Blanchard <anton@samba.org>
Subject: Re: [PATCH] powerpc/fadump: Fix the race in crash_fadump().
Date: Fri, 14 Oct 2016 11:42:45 +1100 [thread overview]
Message-ID: <62282745-bf75-24df-d686-464bf58e05e8@gmail.com> (raw)
In-Reply-To: <8c44acaa-e72a-c66a-4e8e-d3518b8ba571@linux.vnet.ibm.com>
On 13/10/16 04:48, Mahesh Jagannath Salgaonkar wrote:
> On 10/10/2016 04:22 PM, Michael Ellerman wrote:
>> Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com> writes:
>>
>>> From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
>>>
>>> There are chances that multiple CPUs can call crash_fadump() simultaneously
>>> and would start duplicating same info to vmcoreinfo ELF note section. This
>>> causes makedumpfile to fail during kdump capture. One example is,
>>> triggering dumprestart from HMC which sends system reset to all the CPUs at
>>> once.
>> ...
>>> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
>>> index b3a6633..2ed9d1c 100644
>>> --- a/arch/powerpc/kernel/fadump.c
>>> +++ b/arch/powerpc/kernel/fadump.c
>>> @@ -402,8 +402,14 @@ void crash_fadump(struct pt_regs *regs, const char *str)
>>> {
>>> struct fadump_crash_info_header *fdh = NULL;
>>>
>>> - if (!fw_dump.dump_registered || !fw_dump.fadumphdr_addr)
>>> + mutex_lock(&fadump_mutex);
>>
>> What happens when a crashing CPU can't get the mutex and goes to sleep?
>
> Got your point. I think I should use mutex_trylock() here. There is only
> two reason crashing CPU can't get mutex, 1) Another CPU also crashing
> that got the mutex and on its way to trigger fadump. OR 2) We are in
> middle of fadump register/un-register, in which case we can just return
> and go to normal panic.
I think trylock is a good idea, but having said that not getting the lock
and having the CPU active will still lead to the same issue.
I don't quite know the source of failure in makedumpfile but
should we fix makedumpfile to deal better with these issues?
Another option is to check to see if anyone started writing at the ELF
note section and have others bail out if they get there after the try
lock
Balbir Singh.
prev parent reply other threads:[~2016-10-14 0:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-10 6:30 [PATCH] powerpc/fadump: Fix the race in crash_fadump() Mahesh J Salgaonkar
2016-10-10 10:52 ` Michael Ellerman
2016-10-12 17:48 ` Mahesh Jagannath Salgaonkar
2016-10-13 10:48 ` Michael Ellerman
2016-10-14 0:42 ` Balbir Singh [this message]
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=62282745-bf75-24df-d686-464bf58e05e8@gmail.com \
--to=bsingharora@gmail.com \
--cc=anton@samba.org \
--cc=hbabu@us.ibm.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=mahesh@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
/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).