Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp614715pxb; Thu, 23 Sep 2021 07:15:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9WmteziSejesMHldRBiCElGQb2GqIYztJEAH52yLun1sHPVz/j6LidlrUITBho3rTAWQ2 X-Received: by 2002:aa7:cf93:: with SMTP id z19mr5732621edx.202.1632406512829; Thu, 23 Sep 2021 07:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632406512; cv=none; d=google.com; s=arc-20160816; b=wJLy3ZvzBhxd5ihVHElHbrnCiFHvHJf4lJhfVPh5pQJiND3anX8eNRqoUvQnE+fVJ5 3OqybR5ZSon4nOht2xhRlZE2fRFNA+M7Ry9Pf9MYFdm3OIx59qh0EYyWp3M/YDaWV9c3 dLGh8lTbNnBmURJKj4Z4XYJQp3R6S0hFlnuiHAL7CdvxttfOfjayvetC82F976l405Yu FbOxGIIvMbV/dhX5/QvC2kTcj0da8Jn7eVNvDylNgHFtzdfZyUA+12PUzSPNiIRsNNdO +3XM2HEjJUcxx/+siBGivo6cIe9iFwNK7yNGByCfbYPxhhg5/VXHau/9+V5/S4EYM5eL EpSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lphzpTahG7LS2U3xUhfApocU7Cvv9rH+VCCr6o+2b8Y=; b=cc+CzAjRPfd7f4Ml6s8ozBYr258xTRJPlzL6SP/P8M9TMsAi05PeMA60VCJemkR8pP Rw2Pq/Ob0nS1sCDjbCXGlkfPLpPUqtSaQh1fVgZ2XT+wYPROH3EBETWUU/GbU+1/fPmT x/Hf6KTdYqNrfRt8CQLogzN38Sto9QdY1aydIoHPDfPt6lGY8rg4aR31qvXVrBL0j06n MuGuy5EESrluwbLbQZAN/VYxD1kHbsY2Ksl91zHH/h6Hv/vq0PKTzwFCphFU0G899ZYQ efnZYTUop3xs3ZPufEFQgFsMMtigykrbelxrn9KK0eKquIMcyOivaAWZOdgpdrppUeho N0Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="qcsYU/TH"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb10si3945816edb.16.2021.09.23.07.14.44; Thu, 23 Sep 2021 07:15:12 -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=@gmail.com header.s=20210112 header.b="qcsYU/TH"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241703AbhIWOMH (ORCPT + 99 others); Thu, 23 Sep 2021 10:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241386AbhIWOL7 (ORCPT ); Thu, 23 Sep 2021 10:11:59 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81ED0C061574 for ; Thu, 23 Sep 2021 07:10:28 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id 203so5797151pfy.13 for ; Thu, 23 Sep 2021 07:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lphzpTahG7LS2U3xUhfApocU7Cvv9rH+VCCr6o+2b8Y=; b=qcsYU/THvUOnuM29w7s91OlHkUBzEAzfkN0KtxkaHKDFjImyTzJqndOA1fNGd3Zzy2 V/zgScFiEUXVSE/K6Kgifv7rXgjkuXKiv12CKNXJX60Q49qn0ssI4aLluyHYEoYNzjzt k2+dUVPzDzViKMNh1gBxudyzkCFUDnPbPNU2yYlsmfzLeWuGKg9xFqpMCqvJjZBoAiKB e6H/epEhJvbb1LAX7GdLBYh99t82SmePrs1Gbxz+7KymQfFjVGjseXrcGrgNBlDJhTV4 fMpluhxmyV7tJ/GkUR4QBWKK7LlCRitECReP7XV4Dib+S/lUUxG3mep6MHltRmlvKgH5 DRkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lphzpTahG7LS2U3xUhfApocU7Cvv9rH+VCCr6o+2b8Y=; b=kzzzxOVonbUhLx13zLms5Y6FzWnNfTpjS7SAk5y5FKkUi2QpLW/2ZhhojJaG14nv55 2H6BQYbsS89hUHx1rrq2zcRIdXfYMdbuj38gK0SYNopGUVbWLcC94zTX7SqszVcjsKFR rMHMNH+jmA6NNUd7wgD3pL8JIrGlToz388qF47CITjghsfrY6WsOVwU5edKQ3Up1NQjj AGdSX+UqPNDmeGE3Po3LeLeiFb1IrXGmR4P9CLaGY/mik6QC0V87DuVi1VwdP5kxjhAa 5XOW5LqfSWZFFyhD6XhlMMxP0iEACzH7KQ/E/hJC1/qLdO1PFc3GT2Hx/4CVfVp6+eGO 1Sjw== X-Gm-Message-State: AOAM532w9kj4VERjR7oZW0zlSVYVxnsXvaNHs83hnttZzdbkdL8+3Qk6 4B49Wdxmn/vGRmruoQLWXsI/kMb0TQ== X-Received: by 2002:a62:7f87:0:b0:444:b077:51ef with SMTP id a129-20020a627f87000000b00444b07751efmr4653569pfd.61.1632406227945; Thu, 23 Sep 2021 07:10:27 -0700 (PDT) Received: from piliu.users.ipa.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id j6sm5800766pfn.107.2021.09.23.07.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Sep 2021 07:10:27 -0700 (PDT) From: Pingfan Liu To: linux-kernel@vger.kernel.org Cc: Pingfan Liu , Petr Mladek , Andrew Morton , Wang Qing , "Peter Zijlstra (Intel)" , Santosh Sivaraj , linux-arm-kernel@lists.infradead.org Subject: [PATCHv2 2/4] kernel/watchdog_hld: clarify the condition in hardlockup_detector_event_create() Date: Thu, 23 Sep 2021 22:09:49 +0800 Message-Id: <20210923140951.35902-3-kernelfans@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210923140951.35902-1-kernelfans@gmail.com> References: <20210923140951.35902-1-kernelfans@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As for the context, there are two arguments to change debug_smp_processor_id() to is_percpu_thread(). -1. watchdog_ev is percpu, and migration will frustrate the attempt which try to bind a watchdog_ev to a cpu by protecting this func inside the pair of preempt_disable()/preempt_enable(). -2. hardlockup_detector_event_create() indirectly calls kmem_cache_alloc_node(), which is blockable. So here, spelling out the really planned context "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: linux-arm-kernel@lists.infradead.org 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..df010df76576 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 */ + WARN_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); -- 2.31.1