Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1440248rwb; Sun, 18 Sep 2022 07:23:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4R8SR4vE4nN6D7d9hT8/9jWaq9gNJR4gwyNyXi/Gl8pEuQ4T7Ikrwe3Ano1B5hke/M6AVX X-Received: by 2002:a05:6a00:e85:b0:52b:5db8:f3df with SMTP id bo5-20020a056a000e8500b0052b5db8f3dfmr14300576pfb.14.1663511002848; Sun, 18 Sep 2022 07:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663511002; cv=none; d=google.com; s=arc-20160816; b=OrPx9m/W4Kfeq/hkTnnrnti2ctsrFSm93gaPpy6d4JEA7Mfe41Q+sULSsmeZDQqSKS 2WiHmzJ2gYapAjpgpOlSKrns9Ioshw6wRiGwLWxhO0nXBAbNuQKqKBxT9s/5Baub3c6T 9ikqdUASV6CVQ7S0uFCK1/bAH94mAvAcZs+b5rIg5Uk5Ktd+RSBnblr7k3AphFyVE2Jl kaKKwN7YRE+jVIzJqbdnbrNQCdCcuiKeyL1rt1IjA+hHpxsE3igTBND2/EWAfY7jBgUF 0Xph/0PE5dEOXm0sAMLjMSZZNqaGThiG/JbACF3Sq5+vNHoIgE3mbBMe+rwdd9H61pVK tcDg== 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=vgMvcabAponECpj7LkBelpsJYBmHvShrlJGOD0sG9pE=; b=HQ5dy1gH5s4Uk/dP2AEE+ro1LGET+7XoocBdM5u5/GdmuF1pXLvtqyKpQT1yuFE/rk LTalJ0eH+gUXw+4e/fqkxC9WATdBiAANTUqWRPjpKguFIXw8g4e3DSM6tS2QZJ2+blMu Fw2zlg/EuJvc/zchhKIVR4VNsZ3VJt2hO7vQjL0yZTbUlMjQk6Q2Vr0NMH2vmNDRWZtC tUuwL4ItHsoYh/kn0cxRSyPZW+ahPQMoUqOq2TGF9z2EuzOcE0xP+98gdwpmvoNPuO70 KAPt2x4k+Op+yV8fdhJ1VyAfH6kcOwAkDJ27ic1llAttOLqJX6exLiBo/0xVeT8RUbs+ 3UFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=TTCkZr67; 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 e2-20020a170902b78200b00176be20c432si3058860pls.271.2022.09.18.07.23.11; Sun, 18 Sep 2022 07:23:22 -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=TTCkZr67; 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 S229515AbiIROMx (ORCPT + 99 others); Sun, 18 Sep 2022 10:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiIROMv (ORCPT ); Sun, 18 Sep 2022 10:12:51 -0400 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB88C20BE7; Sun, 18 Sep 2022 07:12:50 -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=vgMvcabAponECpj7LkBelpsJYBmHvShrlJGOD0sG9pE=; b=TTCkZr67oCPEg4W6TAiKui93RE zGjwqVg2v7U28Zq7BmtnJIFeyKD3RT6oaLMZytqo0SmjtEi4xnnUZqEBIbo/sn14Qf049AyKT6vg+ qUbhrl6Ky7sFlpcv9Vb6f5aUY6b6Bx1pNiCwBOZ8OP0fTxR/8WA7ez8BWfoMquFKgo8U+n+Yf9GPd Ma9bQpq2RIHh0j96uScSPjHqUWY76MvQPZs/tqV0JGBh+7TxIEM4PTR3LajWg0nZipmu/MTHquGn4 HYm5FoWXA1hIeNeFC4M3jrSlTjfoWBmKP+f1HGX54rU4kAEWX4QGbCqjXseT9yyCLWET4dvJcyPXF oWj2nxOQ==; Received: from 201-27-35-168.dsl.telesp.net.br ([201.27.35.168] 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 1oZv2N-0081tk-VV; Sun, 18 Sep 2022 16:12:48 +0200 Message-ID: <89f8fb2d-3f39-4591-190c-f134c4c173a6@igalia.com> Date: Sun, 18 Sep 2022 11:12:15 -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 09/11] video/hyperv_fb: Avoid taking busy spinlock on panic path Content-Language: en-US To: linux-hyperv@vger.kernel.org, mikelley@microsoft.com Cc: kexec@lists.infradead.org, pmladek@suse.com, bhe@redhat.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, kernel-dev@igalia.com, kernel@gpiccoli.net, halves@canonical.com, fabiomirmar@gmail.com, alejandro.j.jimenez@oracle.com, andriy.shevchenko@linux.intel.com, arnd@arndb.de, bp@alien8.de, corbet@lwn.net, d.hatayama@jp.fujitsu.com, dave.hansen@linux.intel.com, dyoung@redhat.com, feng.tang@intel.com, gregkh@linuxfoundation.org, hidehiro.kawai.ez@hitachi.com, jgross@suse.com, john.ogness@linutronix.de, keescook@chromium.org, luto@kernel.org, mhiramat@kernel.org, mingo@redhat.com, paulmck@kernel.org, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, stern@rowland.harvard.edu, tglx@linutronix.de, vgoyal@redhat.com, vkuznets@redhat.com, will@kernel.org, xuqiang36@huawei.com, Andrea Parri , Dexuan Cui , Haiyang Zhang , "K. Y. Srinivasan" , Stephen Hemminger , Tianyu Lan , Wei Liu References: <20220819221731.480795-1-gpiccoli@igalia.com> <20220819221731.480795-10-gpiccoli@igalia.com> From: "Guilherme G. Piccoli" In-Reply-To: <20220819221731.480795-10-gpiccoli@igalia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS 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 19/08/2022 19:17, Guilherme G. Piccoli wrote: > The Hyper-V framebuffer code registers a panic notifier in order > to try updating its fbdev if the kernel crashed. The notifier > callback is straightforward, but it calls the vmbus_sendpacket() > routine eventually, and such function takes a spinlock for the > ring buffer operations. > > Panic path runs in atomic context, with local interrupts and > preemption disabled, and all secondary CPUs shutdown. That said, > taking a spinlock might cause a lockup if a secondary CPU was > disabled with such lock taken. Fix it here by checking if the > ring buffer spinlock is busy on Hyper-V framebuffer panic notifier; > if so, bail-out avoiding the potential lockup scenario. > > Cc: Andrea Parri (Microsoft) > Cc: Dexuan Cui > Cc: Haiyang Zhang > Cc: "K. Y. Srinivasan" > Cc: Michael Kelley > Cc: Stephen Hemminger > Cc: Tianyu Lan > Cc: Wei Liu > Tested-by: Fabio A M Martins > Signed-off-by: Guilherme G. Piccoli > > --- > > V3: > - simplified the code based on Michael's suggestion - thanks! > > V2: > - new patch, based on the discussion in [0]. > [0] https://lore.kernel.org/lkml/2787b476-6366-1c83-db80-0393da417497@igalia.com/ > > > drivers/hv/ring_buffer.c | 13 +++++++++++++ > drivers/video/fbdev/hyperv_fb.c | 8 +++++++- > include/linux/hyperv.h | 2 ++ > 3 files changed, 22 insertions(+), 1 deletion(-) > [...] Hi Michael, apologies for the ping. Any reviews/comments on this one are greatly appreciated! Cheers, Guilherme