Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1021689rwe; Thu, 1 Sep 2022 11:08:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR6rf+F92dPGCnBdUXaUaaWfwm8zWceNeD21mtnQxFt0ts/nU0s5cEe9BxROL9ieyGAnQY2I X-Received: by 2002:a17:907:7e8a:b0:732:ff29:d1d6 with SMTP id qb10-20020a1709077e8a00b00732ff29d1d6mr24710944ejc.175.1662055687680; Thu, 01 Sep 2022 11:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662055687; cv=none; d=google.com; s=arc-20160816; b=kqeMYphVmPl+83SU8PJ9wGPKhjJjMkkZBzedQroMXqS+1GGq27Ean8oQtAOarJVRgh PrTRrsU/ZjWHxZ1EtjEuvHsDH8m9jcyBOR7MEFy9LymElc/MSp+kUq1L2JhdCO6biTm8 I0TW5gHPhIn3WDDc77zLwXP5+vL136H7Jh1VBYiWTQlNLc4km9qIUEopAh/oWI36izvn AmZGziu3+sVKI3VrP2AdIqputWGjyw7YK0OiGvfxT8SDstd+upczmptAO+l1sRxWwKJi x+1p3hpfSPET7GjzfVom2uecquC7s91iIKjOK38FOqO6LaMhZBZ4PXwl3qtfsKRR0Muj U7pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=jG1diFKmAnHq55rmungboNRp5UxEdvvxP5T+GF1eM+o=; b=QXKX2VmHOOlZhfheH/rR4N4o2JOtsPgx3KmjDXz4PnOhmhnwBNZxF2OG/usts47o9Z 1fqdqm/uB9koS0D38csfwvoumoK/UONBea1OzpVJh1BUoeyFGJ+Pn8/db67CRGJLgjcg dy6chsauVlRWZ54wYIdPSUvn5C5J1khM8uwO6dO/owzr8t1KWhroq2btf4xVzPzr8T83 CiylUGqTkB8qk2z1FvXKX1a8Q9rtp955/33xueO7EDvF63tc7QvjaYczKm6YnxApPck5 VwJAfvTEvflj+WG2l4QlXYR2zI8nhypLZcqRs6Rfm59VwoF0ssDPvK6U04Zdf2MyxnYu 0C5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=JmJhfwm9; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a05640234d500b00446986021f3si2494119edc.22.2022.09.01.11.07.39; Thu, 01 Sep 2022 11:08:07 -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=fail header.i=@igalia.com header.s=20170329 header.b=JmJhfwm9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233848AbiIARrs (ORCPT + 99 others); Thu, 1 Sep 2022 13:47:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233295AbiIARrY (ORCPT ); Thu, 1 Sep 2022 13:47:24 -0400 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48A162A72C; Thu, 1 Sep 2022 10:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jG1diFKmAnHq55rmungboNRp5UxEdvvxP5T+GF1eM+o=; b=JmJhfwm9B+IKOtcaWKo8wllhi9 bIoTPO8pisJ8sBfD8BhnjGd3T2x1tYWNwjZXD+5bbwQmmBpzcrJ26LIJcZ1eEuiyOACVvu+y18I3v lEXMQxdqsXD3ERXToXsaDXBxJkuoGVgDXVdS/EuWvm5olQmzmVHzdB3Zq1g1Prmg89VW/sQcWkS9S 5M+/SfB9u80s1Njbe6gh8GeZ9N3UidFntusoNzxnTRW/uzl1dabwZukyaLl4cslsI0G92S1B/iOEB d07vzEPEylgobuA03CarQQooRZL0YAgwiodM8PoJzPM1RBP8v94PQOaGaOGf8omX+TlH8HQ7ugaU9 mUp/Rocg==; Received: from 189-69-202-182.dial-up.telesp.net.br ([189.69.202.182] helo=[192.168.1.60]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1oToHN-007s7h-Q5; Thu, 01 Sep 2022 19:47:02 +0200 Message-ID: <85683284-db85-7e3a-57bd-750e1c204e3e@igalia.com> Date: Thu, 1 Sep 2022 14:46:48 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH V3] firmware: google: Test spinlock on panic path to avoid lockups Content-Language: en-US To: Greg KH , evgreen@chromium.org Cc: arnd@arndb.de, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@gpiccoli.net, ardb@kernel.org, davidgow@google.com, jwerner@chromium.org, Petr Mladek References: <20220819155059.451674-1-gpiccoli@igalia.com> <6bc5dbc3-2cdd-5cb8-1632-11de2008a85a@igalia.com> From: "Guilherme G. Piccoli" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 01/09/2022 13:44, Greg KH wrote: > [...] >>> How are we supposed to know this here? >>> >> >> Reading the code? >> Or you mean, in the commit description this should be mentioned? > > Yes, and in the comment as this type of call is very rare and should > almost never be used. OK, I can add that, for sure. >> [...] >> I don't think it is so simple - we are in the panic path. > > Great, then the lock doesn't matter :) > >> So, imagine the lock was taken in CPU0, where GSMI is doing some >> operation. During that operation, CPU1 panics! >> >> When that happens, panic() executes in CPU1, disabling CPU0 through >> "strong" mechanisms (NMI). So, CPU0 had the lock, it is now off, and >> when CPU1 goes through the panic notifiers, it'll eventually wait >> forever for this lock in the GSMI handler, unless we have this patch >> that would prevent the handler to run in such case. >> Makes sense? > > I'm trying to say "if you are in panic, never grab the lock in the first > place". So change the place when you grab the lock, not here. > Evan, any comment here? I think the patch is still well suited for this case. Suggestions on how to improve it are welcome, of course. I honestly didn't understand exactly what you're suggesting Greg... Mind clarifying? Cheers, Guilherme