From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61C20C433FE for ; Wed, 15 Sep 2021 13:46:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B8816105A for ; Wed, 15 Sep 2021 13:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235101AbhIONre (ORCPT ); Wed, 15 Sep 2021 09:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233440AbhIONrd (ORCPT ); Wed, 15 Sep 2021 09:47:33 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4B7AC061574 for ; Wed, 15 Sep 2021 06:46:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KGeyo69IOf8jXHMIDvz7bZx3lbLuH6HqZKyrsohBeAI=; b=qd7CqgiDWVYAXJjihKTzs3TJJk KN//U6thCnw4XKFxxhsOS22B3m5RIBThcejY8uK+RRtHTF01qSEy+KDfUZhHyRYhWs6TpVEWAM5aX Ms4nQ/kmNn9A60NCWgPZ4Bos7AdDmLzLT78JhdLG2rDAmI+H5Uo1LP9EBh+aBEjNHlGXRPF6qwhpq KMmhsX1oyB9mqdJNsny0jAcPedSglqIjN6ZHJKbOiOn42NT3aUPKs4UuKNan+HTVorSiYy9POaA39 76SGJqD/5dpN4EEsTEZ8KKT/eiSXIhr+SC+keS0BGzWaG3XYv6NlyW4wkgP8EzuvBf6Y3n96zBdue j3bkzw1w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQVDo-00FiXm-SH; Wed, 15 Sep 2021 13:45:15 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id BC1C430003A; Wed, 15 Sep 2021 15:45:06 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 972AB234E53A7; Wed, 15 Sep 2021 15:45:06 +0200 (CEST) Date: Wed, 15 Sep 2021 15:45:06 +0200 From: Peter Zijlstra To: Pingfan Liu Cc: linux-kernel@vger.kernel.org, Petr Mladek , Andrew Morton , Wang Qing , Santosh Sivaraj , Sumit Garg , Will Deacon , Mark Rutland Subject: Re: [PATCH 2/5] kernel/watchdog_hld: clarify the condition in hardlockup_detector_event_create() Message-ID: References: <20210915035103.15586-1-kernelfans@gmail.com> <20210915035103.15586-3-kernelfans@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210915035103.15586-3-kernelfans@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 11:51:00AM +0800, Pingfan Liu wrote: > hardlockup_detector_event_create() indirectly calls > kmem_cache_alloc_node(), which is blockable. > > So here, the really planned context is is_percpu_thread(). > > Signed-off-by: Pingfan Liu > Cc: Petr Mladek > Cc: Andrew Morton > Cc: Wang Qing > Cc: "Peter Zijlstra (Intel)" > Cc: Santosh Sivaraj > Cc: Sumit Garg > Cc: Will Deacon > Cc: Mark Rutland > To: linux-kernel@vger.kernel.org > --- > kernel/watchdog_hld.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c > index 247bf0b1582c..6876e796dbf5 100644 > --- a/kernel/watchdog_hld.c > +++ b/kernel/watchdog_hld.c > @@ -165,10 +165,13 @@ static void watchdog_overflow_callback(struct perf_event *event, > > static int hardlockup_detector_event_create(void) > { > - unsigned int cpu = smp_processor_id(); > + unsigned int cpu; > struct perf_event_attr *wd_attr; > struct perf_event *evt; > > + /* This function plans to execute in cpu bound kthread */ > + BUG_ON(!is_percpu_thread()); > + cpu = raw_smp_processor_id(); > wd_attr = &wd_hw_attr; > wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh); This patch makes no sense.