Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3524124pxb; Mon, 24 Jan 2022 11:22:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgcPe6GZ/qZJwmwYGpd+FYHv6Dq1472joOI4j7+SblSauLk6jqK7frdXLwKvLjtcD2EYcm X-Received: by 2002:a63:7f12:: with SMTP id a18mr3913617pgd.453.1643052145355; Mon, 24 Jan 2022 11:22:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643052145; cv=none; d=google.com; s=arc-20160816; b=kn9vP4kwAqacMbx9NZ64QAaiO8grO6mSVuIMaC2hZ+MKauMLdEW4+lSkGU6C9wOis5 ae6sKpXAL0LMRJ2EVVePbNklwm3pEUHggJeMKSWwtstxGks/hPkyRqoyAx/Syf6YQm1f Z5Q1qJf1UxrgYRScA/QthXSZ9Twtwb1eHKmeL2SY7/BVTZKCaiay6+Q3kVPDxt6k4Jhd 4h/hzkoA35V9rY3ArWw5YIMMQA+N9lD78Htz6KcD4kJM9YqG9tY5Ph7HmSFU99r7Zg79 HCUXtxi1MkA2L4ztFboxPL3MJCYPsGuHxwGdmDuJKPMygsx/vH3QcR3XASw9Td3hotHy QjOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=RciwqzeDbH0CGDVReWAFXEpNAbekgSr4/yuLqwM5lq0=; b=yhh0FEC54wc7woolQZoqpUHXnXSK1Ar/Q3fLcS79G/wQHAmfZrzgFqRWGiyXnNWglW Zj/dMfg8DbA6Qbo6C4JjIgroenqkqXmVsj0JxJfk9wHoYkpXrAAMmOkkztgHP98x/faa 5+xP4rc+qw8sc1OQqj7JyjKMI/YI6mo8yH54duvtKe+AiqBJtGLuYzwjeO5WYazSQsm5 yyO86ibDWxQkSzW0fV0K0iapmF2FZAlksAlxrrHifQ7I+Uhvga1eiFaIxSozEAC5KPCv owP7dXvp7apj+c0LIqVrIJe0MlCkcTy/6ZxWx+i1m+kUHQnJhApkTgxQgjOLG0Srdukc 1UzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aKrGyd4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk16si166868pjb.67.2022.01.24.11.22.12; Mon, 24 Jan 2022 11:22:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aKrGyd4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232969AbiAXOPz (ORCPT + 99 others); Mon, 24 Jan 2022 09:15:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36740 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232281AbiAXOPy (ORCPT ); Mon, 24 Jan 2022 09:15:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643033754; 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=RciwqzeDbH0CGDVReWAFXEpNAbekgSr4/yuLqwM5lq0=; b=aKrGyd4ZM0Stn1bFmaT2Y9ckUzsj4oldeDYqi/292jLjjO/Cj9Mit9w+2wvYSvwFqiX3mZ PDZm9LJzOugRRDF9QUHRlFGCKNNtcZNBBMLchhElSTWe8BbsOICASKTPAmetc6uBoIGYRo UYYthj8A/jTpqGmRHzVd50Oxj5rBo1Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-Lme9-j8yOG-N8Ayxbv9tLw-1; Mon, 24 Jan 2022 09:15:49 -0500 X-MC-Unique: Lme9-j8yOG-N8Ayxbv9tLw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B524809CD9; Mon, 24 Jan 2022 14:15:46 +0000 (UTC) Received: from localhost (ovpn-12-40.pek2.redhat.com [10.72.12.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 444BE7E23D; Mon, 24 Jan 2022 14:15:42 +0000 (UTC) Date: Mon, 24 Jan 2022 22:15:39 +0800 From: Baoquan He To: "d.hatayama@fujitsu.com" Cc: "Guilherme G. Piccoli" , Masami Hiramatsu , Petr Mladek , "kexec@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "dyoung@redhat.com" , "linux-doc@vger.kernel.org" , "vgoyal@redhat.com" , "stern@rowland.harvard.edu" , "akpm@linux-foundation.org" , "andriy.shevchenko@linux.intel.com" , "corbet@lwn.net" , "halves@canonical.com" , "kernel@gpiccoli.net" , Will Deacon , Kees Cook , Steven Rostedt , Hidehiro Kawai , Vitaly Kuznetsov , John Ogness , "Paul E. McKenney" , Peter Zijlstra , Juergen Gross , "mikelley@microsoft.com" Subject: Re: [PATCH V4] notifier/panic: Introduce panic_notifier_filter Message-ID: <20220124141539.GC8305@MiWiFi-R3L-srv> References: <20220108153451.195121-1-gpiccoli@igalia.com> <20220122105514.GA18258@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/24/22 at 11:43am, d.hatayama@fujitsu.com wrote: > > > On 01/21/22 at 05:31pm, Guilherme G. Piccoli wrote: > > ...... > > > > IMHO, the right solution is to split the callbacks into 2 or more > > > > notifier list. Then we might rework panic() to do: > > > > > > > > void panic(void) > > > > { > > > > [...] > > > > > > > > /* stop watchdogs + extra info */ > > > > atomic_notifier_call_chain(&panic_disable_watchdogs_notifier_list, 0, buf); > > > > atomic_notifier_call_chain(&panic_info_notifier_list, 0, buf); > > > > panic_print_sys_info(); > > > > > > > > /* crash_kexec + kmsg_dump in configurable order */ > > > > if (!_crash_kexec_post_kmsg_dump) { > > > > __crash_kexec(NULL); > > > > smp_send_stop(); > > > > } else { > > > > crash_smp_send_stop(); > > > > } > > > > > > > > kmsg_dump(); > > > > if (_crash_kexec_post_kmsg_dump) > > > > __crash_kexec(NULL); > > > > > > > > /* infinite loop or reboot */ > > > > atomic_notifier_call_chain(&panic_hypervisor_notifier_list, 0, buf); > > > > atomic_notifier_call_chain(&panic_rest_notifier_list, 0, buf); > > > > > > > > console_flush_on_panic(CONSOLE_FLUSH_PENDING); > > > > [...] > > > > Two notifier lists might be enough in the above scenario. I would call > > > > them: > > > > > > > > panic_pre_dump_notifier_list > > > > panic_post_dump_notifier_list > > > > > > > > > > > > It is a real solution that will help everyone. It is more complicated now > > > > but it will makes things much easier in the long term. And it might be done > > > > step by step: > > > > > > > > 1. introduce the two notifier lists > > > > 2. convert all users: one by one > > > > 3. remove the original notifier list when there is no user > > > > > > That's a great idea! I'm into it, if we have a consensus. The thing that > > > scares me most here is that this is a big change and consumes time to > > > implement - I'd not risk such time if somebody is really against that. > > > So, let's see more opinions, maybe the kdump maintainers have good input. > > > > I am fine with it. As long as thing is made clear, glad to see code is > > refactored to be more understandable and improved. Earlier, during several > > rounds of discussion between you and Petr, seveal pitfalls have been > > pointed out and avoided. > > > > Meanwhile, I would suggest Masa and HATAYAMA to help give input about > > panic_notifier usage and refactory. AFAIK, they contributed code and use > > panic_notifier in their product or environment a lot, that will be very > > helpful to get the first hand information from them. > > > > Hi Masa, HATAYANA, > > > > Any comment on this? (Please ignore this if it's not in your care.) > > > > Thanks for CCing to me. I like this patch set. I have same motivation. > > For example, when I used crash_kexec_post_notifiers, I sometimes ran into > deadlock in printk's exclusion logic during the call of panic notifiers since > kaslr outputs kernel offset at panic by dump_kernel_offset() via panic notifers > (although this might never happen now thanks to lockless implementation). > > The problem is that in the current design, we have to run all the > tasks registered, although most of them are actually unnecessary for > other users' requirements. Each user wants to call only their own handlers > in order to keep kdump as reliable as possible. If I unerstand you correclty, you are expressing your favour to the panic_notifier filter this patch adds. I personally like it very much either because I know users only expect to run those one or several handlers they added or cared about, from discussing reported cases realted to them, just as you said. Now comments to patch lean to split and classify the current panic notifiers list into two or several sub-lists and execute them in different order. I think this improvement will benefit people who defaults to execute all panic notifiers, while the panic notifier fileter is also very helpful if can be added. Hope I got you right, HATAYAMA. And thanks a lot for your quick response.