On Mon, Jul 14, 2014 at 10:33:26PM +0530, Hari Bathini wrote:
On 07/11/2014 07:03 PM, Vivek Goyal wrote:
>On Thu, Jun 12, 2014 at 08:26:22PM +0530, Hari Bathini wrote:
>>The script dracut-kdump.sh is responsible for capturing vmcore during
>>second kernel boot. Currently this script gets installed into kdump
>>initrd as part of kdumpbase dracut module. Since it's always installed
>>into kdump initrd, this script assumes that '/proc/vmcore' will always
>>be present when it is invoked.
>>
>>With fadump support, 'dracut-kdump.sh' script also gets installed into
>>default initrd to capture vmcore generated by firmware assisted dump.
>>Thus in fadump case, the same initrd is going to be used for normal
>>boot as well as boot after system crash. Hence a check is required to
>>see if '/proc/vmcore' file exists before executing steps to capture
>>vmcore. This check will help to bypass the vmcore capture steps during
>>normal boot process.
>>
>>Signed-off-by: Mahesh Salgaonkar <mahesh(a)linux.vnet.ibm.com>
>>---
>> dracut-kdump.sh | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>>diff --git a/dracut-kdump.sh b/dracut-kdump.sh
>>index cb13d92..55ac8bc 100755
>>--- a/dracut-kdump.sh
>>+++ b/dracut-kdump.sh
>>@@ -1,5 +1,8 @@
>> #!/bin/sh
>>+# continue only if /proc/vmcore is present.
>>+[ ! -f /proc/vmcore ] && return
>>+
>How do we know if it is an error or it is fadump case. What if due to
>some bug /proc/vmcore is not present in case of kdump. We would like
>to detect that case and give proper error message.
>
>I think you need to drop some kind of file in initramfs which tells you
>that you are running from an initramfs built for fadump. Say
>"fadump_initramfs". This can be done during initramfs build process.
A file inside initramfs may not work, as once the initramfs is built,
it will be used for normal as well as kdump kernel.
We may need to think of something else..
Dropping a file in initramfs can atleast help you determine that this
is fadump case. And in that case you can come up with special mechanism
to figure out if /proc/vmcore was supposed to be there or not.
Given that powerpc firmware knows about it and boots kernel in
restricted, memory, may be firmware can export that info to user
space.
But looking at the code, the chances of /proc/vmcore not being
present
seem very slim..
There are error paths where vmcore initilization can fail and /proc/vmcore
will not be present. So /proc/vmcore not being present does not
necessarily mean that we are not booting after crash.
Thanks
Vivek