Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1045169pxb; Wed, 15 Sep 2021 20:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPLUYsC6PSVuKIqbtrjd9fnyjo7JMZFCBLY1dvAc/RFfJ6cSsPdhWX1BmWdj4K9JfO27Hs X-Received: by 2002:a17:906:d04f:: with SMTP id bo15mr3886072ejb.309.1631764788205; Wed, 15 Sep 2021 20:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631764788; cv=none; d=google.com; s=arc-20160816; b=Y5jwXZB1fey1Xop4Te26Ij6Odtul65zoj0s0GWq4LeiMomqKdH/svxOdniRBEF4TEL ZXHf/MTKIQ643aK1/7ArzwOh71xCLRmb4EyVDuEyCbd9b+BxbzBxcs7ljk1k+feXP30V nIY+SEg/tib4IlU9R3TfR8GTOg42/oTEOFu1T3/rfZthujX45uiV9ZSRKJtQ8ll1ty+6 ZCxwmkxKDElen9hb0Z7/lxjGkQpj/Hv759U7k0ejVMyY9KShZfCmpKzjTHEmpG0w5xaO Vcf9AZ7fOzGFfW0O5gTy72yPGARcurZGCTdiQLyCZbzY/owEunyIbhJLYpKnPUsxJxuf 3dBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hNTVI4DHdE4iH7+lWLOfR6K8Vz2L3FwykdFKQ1bK5eo=; b=jisbODRurN6Iby285QBPXw3GD/6tPbaLXx5VKHOy2p0xcdyzYLVH/vuJCvwfCp9yKC lOTN521kBMrz4jw4KQkjlqbDX/ijz8nxEXFiqVqPnRzEUdTve1ElPaRnrRAOtjJZxKiz 3hqct9tp3Hc+ITuZgR67xpYjl2WcJc2C4rTzBAUEd3XQRw4dFLV4Oh1p0LsygQUlMsEH q+hjC9+lIBv6vhpHxLyBqoAbi+iPjrwkyZVQJkQNaxsQ9q+z2XouCkHtR3oyZ0fMApBT 3GVGFP7Fe5BS5BFEy49nhmMlFdsO4wtjEvmZ8b1YOmcCUnPqo6OT4mvpGEiR7IYoW5rc YZQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NuMMS2cl; 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 21si2330931eji.148.2021.09.15.20.59.23; Wed, 15 Sep 2021 20:59:48 -0700 (PDT) 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=NuMMS2cl; 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 S234141AbhIPD7X (ORCPT + 99 others); Wed, 15 Sep 2021 23:59:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56180 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232217AbhIPD7W (ORCPT ); Wed, 15 Sep 2021 23:59:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631764681; 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=hNTVI4DHdE4iH7+lWLOfR6K8Vz2L3FwykdFKQ1bK5eo=; b=NuMMS2clKsFBUAjAEq629rbNsGcqgSPuovtOxNM0yb94DUznVz8MwINf17aHsVz1+90b2x bgIrQUBd0LRK5+LF/GRmJQlq+3T815gecwm0w8p6k4Bv092csPmYLbK4Dl4+rBKORE0ePP 3E0Mn9Xmqm0ZqZPpNJUlEkbQN5GKzok= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-dCJgUVJpM26-lcpE4cnw-A-1; Wed, 15 Sep 2021 23:57:58 -0400 X-MC-Unique: dCJgUVJpM26-lcpE4cnw-A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F360343D0; Thu, 16 Sep 2021 03:57:55 +0000 (UTC) Received: from piliu.users.ipa.redhat.com (ovpn-8-20.pek2.redhat.com [10.72.8.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DB0810016FB; Thu, 16 Sep 2021 03:57:48 +0000 (UTC) Date: Thu, 16 Sep 2021 11:57:44 +0800 From: Pingfan Liu To: Peter Zijlstra Cc: Pingfan Liu , 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: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 03:45:06PM +0200, Peter Zijlstra wrote: > 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. This patch aims to disable any attempt such as using get_cpu()/put_cpu() to shut up the check_preemption_disabled(). But if anybody is familiar with the integration of watchdog_hld and cpuhp, he should know the right way without this BUG_ON() or warn. Do you still think it is pointless? Thanks, Pingfan