Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2731019iob; Fri, 6 May 2022 09:11:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5bcvCI+/7QQx45PHimCwnnPGVQcE6KAPwQHW7JGiXS7htJc2D7Yu1gLvg+2b2QH1dT8QP X-Received: by 2002:a17:906:6a0f:b0:6f5:15cf:2e5 with SMTP id qw15-20020a1709066a0f00b006f515cf02e5mr3559938ejc.584.1651853504430; Fri, 06 May 2022 09:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651853504; cv=none; d=google.com; s=arc-20160816; b=h5OfO5W3aUyXsTXPUm1lPwdlRFUyKYtSdiVisouyBR9zdfz+cKBcsG9PL/E7NRoMOa LTtvx/FvVPXGAp9msWF9nmPxd2Pb2rNwYu/R4972kC1o55LHJm1iwuTxZzTyYfxW1A1+ wxZJE7MG5vOKQoAtc5yQ44iMG/Y1iSYwCFSPbUA1PvPX3NcE7HTTN3eVVHNPk9CGUKKS ZlWu6PEtcyFyBq/koCKXIpWm9hU1HfR7QFUJJrEqoGmc4/BaayLYPqDJk05Ckj9x6VzP Jyb7BsiSzLNtnYUtFUWvRSuqVduTf/YxdoMzYFKXn95jfBsQTzjf0F2EQQRS+0CZsHZx XfNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/FAQ/dxsTqpBs7WGipnOl4836xXTkcXGuRi6ed6aKpk=; b=LsERii273xagmFTIeSyM+1ppPRJA65zLkw7Kf7gY35v4YmckH25zpVZSgXT2DMpFl4 RRxFOvUKhGGsdCJdjMFPDQj0Soq6kTJ0KBtVOi4sUvA9ILdjmMnB6fB4U4Bz59bDUETM dWa34HzK1BW7DFZZCw8LBZ+WESm7OUVArUKT/tj7W0NFrtQOvz3aaRXCXCNx9yHmGMWu xK3YbqVlEfZAK/MtnMwFkh3NOSsHFDcHSsuIQcotJBNN/NHcltbikwtjArQOk9h/RMag m92C8FTBD9XeL9MP+hSN3S9cEHttiG6gq+zmmGMRabYnT7Y1bh09MmMt95QNsfd+j+10 ASXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 22-20020a170906301600b006e8a0b9f086si4877924ejz.487.2022.05.06.09.11.17; Fri, 06 May 2022 09:11:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379943AbiEEOfo (ORCPT + 99 others); Thu, 5 May 2022 10:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230462AbiEEOfn (ORCPT ); Thu, 5 May 2022 10:35:43 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 84B471139; Thu, 5 May 2022 07:32:03 -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 4D254106F; Thu, 5 May 2022 07:32:03 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.38.147]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9F2583F85F; Thu, 5 May 2022 07:32:01 -0700 (PDT) Date: Thu, 5 May 2022 15:31:56 +0100 From: Mark Rutland To: Vitaly Kuznetsov Cc: "Guilherme G. Piccoli" , "Michael Kelley (LINUX)" , Marc Zyngier , Catalin Marinas , will Deacon , 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> <874k24igjf.wl-maz@kernel.org> <92645c41-96fd-2755-552f-133675721a24@igalia.com> <3bee47db-f771-b502-82a3-d6fac388aa89@igalia.com> <878rrg13zb.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <878rrg13zb.fsf@redhat.com> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 05, 2022 at 03:52:24PM +0200, Vitaly Kuznetsov wrote: > "Guilherme G. Piccoli" writes: > > > On 05/05/2022 09:53, Mark Rutland wrote: > >> [...] > >> Looking at those, the cleanup work is all arch-specific. What exactly would we > >> need to do on arm64, and why does it need to happen at that point specifically? > >> On arm64 we don't expect as much paravirtualization as on x86, so it's not > >> clear to me whether we need anything at all. > >> > >>> Anyway, the idea here was to gather a feedback on how "receptive" arm64 > >>> community would be to allow such customization, appreciated your feedback =) > >> > >> ... and are you trying to do this for Hyper-V or just using that as an example? > >> > >> I think we're not going to be very receptive without a more concrete example of > >> what you want. > >> > >> What exactly do *you* need, and *why*? Is that for Hyper-V or another hypervisor? > >> > >> Thanks > >> Mark. > > > > Hi Mark, my plan would be doing that for Hyper-V - kind of the same > > code, almost. For example, in hv_crash_handler() there is a stimer > > clean-up and the vmbus unload - my understanding is that this same code > > would need to run in arm64. Michael Kelley is CCed, he was discussing > > with me in the panic notifiers thread and may elaborate more on the needs. > > > > But also (not related with my specific plan), I've seen KVM quiesce code > > on x86 as well [see kvm_crash_shutdown() on arch/x86] , I'm not sure if > > this is necessary for arm64 or if this already executing in some > > abstracted form, I didn't dig deep - probably Vitaly is aware of that, > > hence I've CCed him here. > > Speaking about the difference between reboot notifiers call chain and > machine_ops.crash_shutdown for KVM/x86, the main difference is that > reboot notifier is called on some CPU while the VM is fully functional, > this way we may e.g. still use IPIs (see kvm_pv_reboot_notify() doing > on_each_cpu()). When we're in a crash situation, > machine_ops.crash_shutdown is called on the CPU which crashed. We can't > count on IPIs still being functional so we do the very basic minimum so > *this* CPU can boot kdump kernel. There's no guarantee other CPUs can > still boot but normally we do kdump with 'nprocs=1'. Sure; IIUC the IPI problem doesn't apply to arm64, though, since that doesn't use a PV mechanism (and practically speaking will either be GICv2 or GICv3). > For Hyper-V, the situation is similar: hv_crash_handler() intitiates > VMbus unload on the crashing CPU only, there's no mechanism to do > 'global' unload so other CPUs will likely not be able to connect Vmbus > devices in kdump kernel but this should not be necessary. Given kdump is best-effort (and we can't rely on secondary CPUs even making it into the kdump kernel), I also don't think that should be necessary. > There's a crash_kexec_post_notifiers mechanism which can be used instead > but it's disabled by default so using machine_ops.crash_shutdown is > better. Another option is to defer this to the kdump kernel. On arm64 at least, we know if we're in a kdump kernel early on, and can reset some state based upon that. Looking at x86's hyperv_cleanup(), everything relevant to arm64 can be deferred to just before the kdump kernel detects and initializes anything relating to hyperv. So AFAICT we could have hyperv_init() check is_kdump_kernel() prior to the first hypercall, and do the cleanup/reset there. Maybe we need more data for the vmbus bits? ... if so it seems that could blow up anyway when the first kernel was tearing down. Thanks, Mark.