Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3630809pxj; Mon, 21 Jun 2021 03:10:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX/N45cj64XtNFhtek3buSFUplh+zxCL93bMN551/vC8tzJzpHcgDz5GgqgdJMmHdARcjD X-Received: by 2002:a17:907:9862:: with SMTP id ko2mr17614463ejc.154.1624270204045; Mon, 21 Jun 2021 03:10:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624270204; cv=none; d=google.com; s=arc-20160816; b=KPz43Vem0hG4LOQMeQWl08ga+hG6TisbNODa/9qqYPKv8rCKe0gYdF4s3FlcO4Ptlw 1Iok9UaKxLo5hFzmYFPTmgQOmhJp1e9Lv1Eh5hRIm4y8SZjw0eEszrs4kQ3PCKZpjaaB ekHo98qi/ACuqik2+eFytp3IBKuxjwpCVckvGgeIxaTggpxYA9CQBHKH6O6J5H5MdKsj Hn4DBpIonA2aU1O2WkkyGRUiymQtAc4mSZTnSap4bO15xmQZ5DZdvKyPI5lGv+QZ45XI W+H5GXgohM0iOFaasZ94Zs4GhQAs6z7aqCkL7XXGDqN/wPbwy4RqHcOBE+zhage+FG0g yTRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ytwuzTx5/gO4b3COQc0j73A7aYxQ0uPUPS5MuWYgV4k=; b=ZyZDlH5uD18XlqhbiaeAgDcAh/vrbQWYZCWwmapaMjEoyF3WvbtMKdibLxIykvw+wr JNKIAtq3laGjDdsSJx+pS/kajGySSAMnYlsM/Tfr68AaR5cI+39U22VoiAQGNW9GLnVj TcRDQxX5pBqd/P49faxgcwpCv66o5gLGwYhReg+8nNBzXW9Jl0Z8oD9MMTDHpQo8I8TA xsoz7mdPtk9nBwIyJ7sJhFNeD5+Ax+y2UCBvKjx7Sm5kzgoXV+eCgca9h8VqwHGkVKkT vhXEF5/fVgWQj7DK6SFI/sPj222G17+iJUnffnuH907kdVj7M3jAZHRYrP2jF/q5drLh Meug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HZlrDwKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h93si18259050edd.584.2021.06.21.03.09.40; Mon, 21 Jun 2021 03:10:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HZlrDwKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229663AbhFUKK5 (ORCPT + 99 others); Mon, 21 Jun 2021 06:10:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:57582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbhFUKK4 (ORCPT ); Mon, 21 Jun 2021 06:10:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F322260FDA; Mon, 21 Jun 2021 10:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624270122; bh=aHrejGGcmDmIhHj+HUSwWdS8/KvXclSYfcHaMm1QTCc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HZlrDwKF3G7g21ohNC77q0CggSLV737MxzTdkxPS55h0g9gslBKC1vQPJTBSsk4da X0DQMo89P1h0V5le6YEk5pExHOLGFEXAAbu0B9/0axX8+HSJL7xJDwj4DJilmgDnVJ C8WDN+GqSzc1/S5pCLKF28lIkQTELeD5UA16mbUEarov5KOIU7eG64kVvRYFDMUnKN RLKgqEkw1X2hIqrmBxnIhhAyz5sVYMpdgKT9au25LFzRUgrql4yD7C+a/8RLBPX+8B nW7j2ypbQaQzt5hn/eJ8+wZX1heeJY32nd5l1a8mDmLiiLRfmgNB3+7aTY948MOIlL e1L6fMpOARASQ== Date: Mon, 21 Jun 2021 11:08:37 +0100 From: Will Deacon To: Huang Shijie Cc: Pavel Tatashin , Catalin Marinas , tabba@google.com, Ard Biesheuvel , Mark Rutland , Linux ARM , LKML , patches@amperecomputing.com, zwang@amperecomputing.com Subject: Re: [PATCH] arm64: kexec: flush log to console in nmi_panic() Message-ID: <20210621100836.GA28788@willie-the-truck> References: <20210617125023.7288-1-shijie@os.amperecomputing.com> <20210617175211.GE24813@willie-the-truck> <20210617175822.GG24813@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 18, 2021 at 09:03:26AM +0000, Huang Shijie wrote: > On Thu, Jun 17, 2021 at 06:58:23PM +0100, Will Deacon wrote: > > On Thu, Jun 17, 2021 at 01:55:08PM -0400, Pavel Tatashin wrote: > > > On Thu, Jun 17, 2021 at 1:52 PM Will Deacon wrote: > > > > > > > > On Thu, Jun 17, 2021 at 12:50:23PM +0000, Huang Shijie wrote: > > > > > If kdump is configured, nmi_panic() may run to machine_kexec(). > > > > > > > > > > But in NMI context, the log is put in PER-CPU nmi_print_seq. > > > > > So we can not see any log on the console since we entered the NMI context, > > > > > such as the "Bye!" in previous line. > > > > > > > > > > This patch fixes this issue by two steps: > > > > > 1) Uses printk_safe_flush_on_panic() to flush the log from > > > > > nmi_print_seq to global printk ring buffer, > > > > > 2) Then uses console_flush_on_panic() to flush to console. > > > > > > > > > > After this patch, we can see the "Bye!" log in the panic console. > > > > > > > > Does it matter? I'd be more inclined to remove the print altogether... > We may remove the log in the arm64 code. > > But in the panic() itself, it still has many log, such as: > > .............. > pr_emerg("Kernel panic - not syncing: %s\n", buf); > .............. > dump_stack(); > .............. > kdb_printf("PANIC: %s\n", msg); > > Without this patch, all these log above will loss.. > > > > > > > I agree, the print could be removed entirely. But, my assumption was > > > that this patch meant to flush other buffered prints beside this last > > > "Bye" one. > > > > That sounds like something which should be done in the core code, rather > > than the in the architecture backend (and looks like panic() might do this > > already?) > In the non-kdump code path, the core code will take care of it, please read the > code in panic(). > > But in the kdump code path, the architecture code should take care of it. Why the discrepancy? Wouldn't it make more sense to do this in panic() for both cases, if the prints that we want to display are coming from panic() itself? Will