Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp612784iog; Fri, 17 Jun 2022 09:41:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tZBuK82Nn/tIxwsuAbedlxCE2Lt24N83lJPH5B3J643BP9ihUfnja0BEkyBe243oguzT7i X-Received: by 2002:a17:906:434f:b0:711:eb76:c320 with SMTP id z15-20020a170906434f00b00711eb76c320mr10071789ejm.636.1655484118771; Fri, 17 Jun 2022 09:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655484118; cv=none; d=google.com; s=arc-20160816; b=XZiYtHNRHQW7SOnfVMHbdqx5KXXF6xtd53x0wFs6GCBAE5jU1aFOo9hHnM5pTpYbxM bBNC3vqxgJAm8QYyxUXsZbK/ZsKOV5KT606gmLGKYTtgsmvEp2HXKSbW9yu0ng3JtGZJ OxHO6cou90iFqeXu6LKVcnDsgS8pdjbXOPcpRSkeartHYjRvw8gButPdQf6hlawQ5vB0 hoJz9A7Y6qP24NDIKxiwvqM5UPxhA+Gpd1Ao16LUrcYxMZSrce+8wiwbFYWSy92GGSUf 6LKoFY7AW/g4Ihy1qNRnIPcSnWGUnY6w9uGH8rpmBhZVmGYIaqEFlvZ4nNs0jEeRjNpC 8HHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=IBPwk9nDoQIaL1wwpLaX0H/tPNhFrVWuXXlSyUu7t6s=; b=W3lgw4XaIM/yPu/A1idp/pQjRxkUt9INnpLrKYWxmoUqqrZitH70Schv0IBp9Exz6l 5IsbYKjK2lkXpWD2KJY5nlC/kbd+2hfk7P2MPozxUVUeV2A5SZ6qLbQ7Ms0OdybVbLcg 1pFJnYONYak1JayhaotdDkqjJKQpAAcDkzif59njYvqow9gMpq27Ln/UoUDT4YP7VJAb xnOinLldzg8vq9fPnn3JwXdniyT/4MU+uiFR4SDEMVxAp7wYlmk69Nxgp91dEkI19Uxn wpovWfssgIAcn07gNsIqiONuTGSOb3iUvPe/Kl7YwXoPW8rxiTbh31sFCrRQt1BjTg8d Bapg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q5FxoFQu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn3-20020a0564020ca300b00425fcc5d236si5396038edb.53.2022.06.17.09.41.30; Fri, 17 Jun 2022 09:41:58 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q5FxoFQu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383143AbiFQQJi (ORCPT + 99 others); Fri, 17 Jun 2022 12:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383188AbiFQQJf (ORCPT ); Fri, 17 Jun 2022 12:09:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BAFC234664 for ; Fri, 17 Jun 2022 09:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655482168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IBPwk9nDoQIaL1wwpLaX0H/tPNhFrVWuXXlSyUu7t6s=; b=Q5FxoFQun0YZUNMt5jCDxzgtXQ1VDf9QKUc71SDvClKuNhrQsXIY/Fb/3oiMsqS5fApA29 +i0YWmlg1+M5CholWPEVz5rDs8yfxCjOqiCL+OC24VDkplAkoRJUEwa09BEXaECJRqsJwF iQwIZ14bRptg9raYZ+VaIrqcLygzEVg= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-466-26rf84i-PxKOX3ozoJ6eKw-1; Fri, 17 Jun 2022 12:09:27 -0400 X-MC-Unique: 26rf84i-PxKOX3ozoJ6eKw-1 Received: by mail-wm1-f70.google.com with SMTP id c185-20020a1c35c2000000b0039db3e56c39so2893570wma.5 for ; Fri, 17 Jun 2022 09:09:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=IBPwk9nDoQIaL1wwpLaX0H/tPNhFrVWuXXlSyUu7t6s=; b=C3K+0Y3GS8rS3pAaM+zgWnZgyjBHMIDb6YyBZ+18uyW4xVVIf4jpAzlIl7k/FKFH1T /Nv8KCiqHNoaJkXBnJvbPiNrceH3gGKMMeMFUgAiDRjTU5tO2i0+5tt2Ihz6EgnamxRa R3VDc0D/yE7rolk8ASyYsSq7oJS+nugxcv8Z7mQSG1UDdpaATJzU5VJ4kUf/23CmENgK OafaIgoJ0vJxQeSTM/DHDI0wpVZcnFCfaC1ON/rdIurf5TzgCIz1ceOK8er75stsrk11 U/CkvpDQNxbr5Z8AwYj4Oq2rJdXRWiDN1m27QokNazDIKF4YhzEnojIXOrQtomxlxQJ/ ss3g== X-Gm-Message-State: AJIora+0e3YWykHgUHBYT6pE9fAgh5ervGVTa5HH6LoptMhoqvsbYOfh WMOxv3x/JFEPSAT3RB98CtZYDfCMOByzwJ3H1a8gLl4kA9qLoweO/MhZy8GgWCw/paJ4LNCIwG+ c6absLiHLIHkLpb6gbJtw+/1E X-Received: by 2002:a05:600c:2e14:b0:39c:58c4:c6ed with SMTP id o20-20020a05600c2e1400b0039c58c4c6edmr10889834wmf.156.1655482166304; Fri, 17 Jun 2022 09:09:26 -0700 (PDT) X-Received: by 2002:a05:600c:2e14:b0:39c:58c4:c6ed with SMTP id o20-20020a05600c2e1400b0039c58c4c6edmr10889813wmf.156.1655482166046; Fri, 17 Jun 2022 09:09:26 -0700 (PDT) Received: from vschneid.remote.csb ([185.11.37.247]) by smtp.gmail.com with ESMTPSA id k6-20020a05600c1c8600b0039c84c05d88sm11256071wms.23.2022.06.17.09.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 09:09:25 -0700 (PDT) From: Valentin Schneider To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-rt-users@vger.kernel.org, Eric Biederman , Arnd Bergmann , Petr Mladek , Thomas Gleixner , Juri Lelli , "Luis Claudio R. Goncalves" Subject: Re: [PATCH] panic, kexec: Don't mutex_trylock() in __crash_kexec() In-Reply-To: References: <20220616123709.347053-1-vschneid@redhat.com> Date: Fri, 17 Jun 2022 17:09:24 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 17/06/22 17:13, Sebastian Andrzej Siewior wrote: > On 2022-06-16 13:37:09 [+0100], Valentin Schneider wrote: >> Regarding the original explanation for the WARN & return: >> >> I don't get why 2) is a problem - if the lock is acquired by the trylock >> then the critical section will be run without interruption since it >> cannot sleep, the interrupted task may get boosted but that will not >> have any actual impact AFAICT. > > boosting an unrelated task is considered wrong. I don't know how bad > it gets in terms of lock chains since a task is set as owner which did > not actually ask for the lock. > >> Regardless, even if this doesn't sleep, the ->wait_lock in the slowpath >> isn't NMI safe so this needs changing. > > This includes the unlock path which may wake a waiter and deboost. > Both are good points, thank you for lighting my lantern :) >> I've thought about trying to defer the kexec out of an NMI (or IRQ) >> context, but that pretty much means deferring the panic() which I'm >> not sure is such a great idea. > > If we could defer it out of NMI on RT then it would work non-RT, too. If > the system is "stuck" and the NMI is the only to respond then I guess > that it is not a great idea. > Those were pretty much my thoughts. I *think* panic() can be re-entrant on the same CPU if the first entry was from NMI, but that still requires being able to schedule a thread that panics which isn't a given after getting that panic NMI. So for now actually doing the kexec in NMI (or IRQ) context seems to be the less hazardous route. > Sebastian