From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752823AbcGSGw0 (ORCPT ); Tue, 19 Jul 2016 02:52:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35718 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265AbcGSGwX (ORCPT ); Tue, 19 Jul 2016 02:52:23 -0400 Date: Tue, 19 Jul 2016 14:52:07 +0800 From: "'Dave Young'" To: =?utf-8?B?5rKz5ZCI6Iux5a6PIC8gS0FXQUnvvIxISURFSElSTw==?= Cc: Michal Hocko , Toshi Kani , "Peter Zijlstra (Intel)" , Vitaly Kuznetsov , Minfei Huang , "H. Peter Anvin" , Daniel Walker , Ingo Molnar , Takao Indoh , Baoquan He , "x86@kernel.org" , "Lee, Chun-Yi" , Borislav Petkov , Vivek Goyal , Masami Hiramatsu , Petr Mladek , Josh Poimboeuf , Thomas Gleixner , Ingo Molnar , "kexec@lists.infradead.org" , "linux-kernel@vger.kernel.org" , HATAYAMA Daisuke , "Eric W. Biederman" , Tejun Heo , Andrew Morton Subject: Re: [V3 PATCH 1/2] x86/panic: Replace smp_send_stop() with kdump friendly version Message-ID: <20160719065207.GF3326@dhcp-128-65.nay.redhat.com> References: <20160705113323.5864.66834.stgit@softrs> <20160705113325.5864.74840.stgit@softrs> <20160711083449.GA19320@dhcp-128-65.nay.redhat.com> <04EAB7311EE43145B2D3536183D1A84454C6F889@GSjpTKYDCembx31.service.hitachi.net> <20160713020336.GA3222@dhcp-128-65.nay.redhat.com> <04EAB7311EE43145B2D3536183D1A84454C7A1B1@GSjpTKYDCembx31.service.hitachi.net> <20160718090204.GA9749@dhcp-128-65.nay.redhat.com> <04EAB7311EE43145B2D3536183D1A84454C83B25@GSjpTKYDCembx31.service.hitachi.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <04EAB7311EE43145B2D3536183D1A84454C83B25@GSjpTKYDCembx31.service.hitachi.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 19 Jul 2016 06:52:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 07/19/16 at 05:51am, 河合英宏 / KAWAI,HIDEHIRO wrote: > Hi, > > > From: 'Dave Young' [mailto:dyoung@redhat.com] > > Sent: Monday, July 18, 2016 6:02 PM > > On 07/15/16 at 11:50am, 河合英宏 / KAWAI,HIDEHIRO wrote: > > > Hi Dave, > > > > > > Thanks for your reply. > > > > > > > From: 'Dave Young' [mailto:dyoung@redhat.com] > > > > Sent: Wednesday, July 13, 2016 11:04 AM > > > > > > > > On 07/12/16 at 02:49am, 河合英宏 / KAWAI,HIDEHIRO wrote: > > > > > Hi Dave, > > > > > > > > > > Thanks for the comments. > > > > > > > > > > > From: Dave Young [mailto:dyoung@redhat.com] > > > > > > Sent: Monday, July 11, 2016 5:35 PM > > > > > > > > > > > > On 07/05/16 at 08:33pm, Hidehiro Kawai wrote: > [snip] > > > > > > As for this patch I'm not sure it is safe to replace the > > > > > > smp_send_stop with the kdump friendly function. I'm also not sure if > > > > > > the kdump friendly function is safe for kdump. Will glad to hear > > > > > > opinions from other arch experts. > > > > > > > > > > This stuff depends on architectures, so I speak only about > > > > > x86 (the logic doesn't change on other architectures at this time). > > > > > > > > > > kdump path with crash_kexec_post_notifiers disabled: > > > > > panic() > > > > > __crash_kexec() > > > > > crash_setup_regs() > > > > > crash_save_vmcoreinfo() > > > > > machine_crash_shutdown() > > > > > native_machine_crash_shutdown() > > > > > panic_smp_send_stop() /* mostly same as original > > > > > * kdump_nmi_shootdown_cpus() > > > > > */ > > > > > > > > > > kdump path with crash_kexec_post_notifiers enabled: > > > > > panic() > > > > > panic_smp_send_stop() > > > > > __crash_kexec() > > > > > crash_setup_regs() > > > > > crash_save_vmcoreinfo() > > > > > machine_crash_shutdown() > > > > > native_machine_crash_shutdown() > > > > > panic_smp_send_stop() // do nothing > > > > > > > > > > The difference is that stopping other CPUs before crash_setup_regs() > > > > > and crash_save_vmcoreinfo() or not. Since crash_setup_regs() and > > > > > crash_save_vmcoreinfo() just save information to some memory area, > > > > > they wouldn't be affected by panic_smp_send_stop(). This means > > > > > placing panic_smp_send_stop before __crash_kexec is safe. > > > > > > > > > > BTW, I noticed my patch breaks Xen kernel. I'll fix it in the next > > > > > version. > > > > > > > > But it does breaks stuff which depends on cpu not being disabled like problem 1 you mentioned in patch log. > > > > > > As I mentioned in the description of this patch, we should stop > > > other CPUs ASAP to preserve current state either > > > crash_kexec_post_notifiers is enabled or not. > > > Then, all remaining procedures should work well > > > after stopping other CPUs (but keep the CPU map online). > > > > > > Vivek also mentioned similar things: > > > https://lkml.org/lkml/2015/7/14/433 > > > > The implementation in this patchset is different from suggestion in above link? > > > > I think Vivek's suggestion is a good idea, to drop smp_send_stop and do below: > > > > stop_cpus_save_register_state; > > > > if (!crash_kexec_post_notifiers) > > crash_kexec() > > atomic_notifier_call_chain() > > kmsg_dump() > > > > I'm just commenting from code flow point of view, the detail implementation > > definitely need more comments from Arch experts. > > > > Any reason did not move the kdump friendly function to earlier point like > > before previous __crash_kexec() below? > > if (!crash_kexec_post_notifiers) { > > printk_nmi_flush_on_panic(); > > __crash_kexec(NULL); > > } > > The reason why the implementation differs from Vivek's is to keep > the current code flow if crash_kexec_post_notifiers is not specified. > > If we apply Vivek's or your suggestion, it may always cause kdump > to fail on MIPS OCTEON due to Problem 1. I don't want to make things > any worse. I may post a patch for MIPS OCTEON, but I can't test it. > For other architectures, I'm not sure what problems there are. > So at first, I want to fix the case where crash_kexec_post_notifiers is > specified on x86. Then, if all other architectures support > `stop other CPUs before crash_kexec', switch to your or Vivek's > suggesting code. > > Is this acceptable? Maybe you can find someone who can test MIPS OCTEON so that they can give some thoughts first and maybe test a fix? [dyoung@localhost linux]$ ./scripts/get_maintainer.pl -f arch/mips/cavium-octeon Ralf Baechle (supporter:MIPS,commit_signer:32/35=91%) David Daney (commit_signer:21/35=60%,authored:8/35=23%) Aaro Koskinen (commit_signer:15/35=43%,authored:8/35=23%) Janne Huttunen (commit_signer:7/35=20%,authored:7/35=20%) Thomas Gleixner (commit_signer:4/35=11%,authored:2/35=6%) linux-mips@linux-mips.org (open list:MIPS) linux-kernel@vger.kernel.org (open list) Thanks Dave