From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A4C4C433EF for ; Thu, 5 May 2022 11:10:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343853AbiEELOO (ORCPT ); Thu, 5 May 2022 07:14:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356774AbiEELOG (ORCPT ); Thu, 5 May 2022 07:14:06 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 02966140AD; Thu, 5 May 2022 04:10:26 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C8A54106F; Thu, 5 May 2022 04:10:25 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.29.132]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2A6233FA27; Thu, 5 May 2022 04:10:24 -0700 (PDT) Date: Thu, 5 May 2022 12:10:21 +0100 From: Mark Rutland To: "Guilherme G. Piccoli" Cc: Catalin Marinas , will Deacon , "Michael Kelley (LINUX)" , Vitaly Kuznetsov , Marc Zyngier , Russell King , Ard Biesheuvel , broonie@kernel.org, "linux-arm-kernel@lists.infradead.org" , linux-kernel , "linux-hyperv@vger.kernel.org" Subject: Re: Should arm64 have a custom crash shutdown handler? Message-ID: References: <427a8277-49f0-4317-d6c3-4a15d7070e55@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <427a8277-49f0-4317-d6c3-4a15d7070e55@igalia.com> Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@vger.kernel.org On Wed, May 04, 2022 at 05:00:42PM -0300, Guilherme G. Piccoli wrote: > Hi folks, this email is to ask feedback / trigger a discussion about the > concept of custom crash shutdown handler, that is "missing" in arm64 > while it's present in many architectures [mips, powerpc, x86, sh (!)]. > > Currently, when we kexec in arm64, the function machine_crash_shutdown() > is called as a handler to disable CPUs and (potentially) do extra > quiesce work. In the aforementioned architectures, there's a way to > override this function, if for example an hypervisor wish to have its > guests running their own custom shutdown machinery. What exactly do you need to do in this custom shutdown machinery? The general expectation for arm64 is that any hypervisor can implement PSCI, and as long as you have that, CPUs (and the VM as a whole) can be shutdown in a standard way. I suspect what you're actually after is a mechanism to notify the hypervisor when the guest crashes, rather than changing the way the shutdown itself occurs? If so, we already have panic notifiers, and QEMU has a "pvpanic" device using that. See drivers/misc/pvpanic/. Thanks, Mark. > For powerpc/mips, the approach is a generic shutdown function that might > call other handler-registered functions, whereas x86/sh relies in the > "machine_ops" structure, having the crash shutdown as a callback in such > struct. > > The usage for that is very broad, but heavy users are hypervisors like > Hyper-V / KVM (CCed Michael and Vitaly here for this reason). The > discussion about the need for that in arm64 is from another thread [0], > so before start implementing/playing with that, I'd like to ask ARM64 > community if there is any feedback and in case it's positive, what is > the best implementation strategy (struct callback vs. handler call), etc. > > I've CCed ARM64/ARM32 maintainers plus extra people I found as really > involved with ARM architecture - sorry if I added people I shouldn't or > if I forgot somebody (though the ARM mailing-list is CC). > Cheers, > > > Guilherme > > > [0] > https://lore.kernel.org/lkml/2787b476-6366-1c83-db80-0393da417497@igalia.com/ > See the proposed option (b)