From patchwork Thu Sep 23 14:09:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 12513051 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=-8.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 C25BBC433EF for ; Thu, 23 Sep 2021 14:11:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8CB9D60FDC for ; Thu, 23 Sep 2021 14:11:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8CB9D60FDC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Xccg5p7JAa8QTZ/5qXrqmxsJhusGJM8HVq0NkXCjSTw=; b=1lEyS5GoJ1v+id 4ARnvmoLEBAmzuJLBaq7u2mP2qcjz0ErZ9qfAFH+H7GbfSFHF+BbweDPr79AMeErQPjMFbBI9tJJO /INn/WleGxvY+FZj/yNyzIJg8LUsCO6KRiABUIclccElHJo0nnbx1oZ4t59IvPMiDhAP2EyxU+dMX 46CfKH8jEssxykrCZ56jMEXn2hJW51rqhbL8xFi0uZOihuAbYyaQG+6fwLTfRIFjWP96ajwzewV6l V3h6iLQYX3R5S9hC6F1Zm1FnqCCBAIiwibVwfuG+XmJgheZz2MrrZM1D/Mt8JrCcqzAMYQehxxCqs BEw4OqFiE7vsMEFVBomA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTPQf-00BmB1-1S; Thu, 23 Sep 2021 14:10:25 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTPQb-00Bm9e-FY for linux-arm-kernel@lists.infradead.org; Thu, 23 Sep 2021 14:10:23 +0000 Received: by mail-pg1-x532.google.com with SMTP id g184so6450957pgc.6 for ; Thu, 23 Sep 2021 07:10:20 -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:mime-version :content-transfer-encoding; bh=bs8p7jBvxim/Kr15A2OV4dN2/Mya/1qDXohd6hFoZU8=; b=hhQZH3A2YahkZIGyCB11t8MDcxyoHxC3hwtw1e3SDnawMLSo1u+fV76diWFr7dR2VY 1RyitLX3DOn+Jy51CbVQeMMVa+DudjAxej6/vunZFV1qoxt9ppaoB7ZfORi73SKec2oI g+29SO6QIvw1XXIlr9O2UBjUXifiEO0ciK1i8qCisIDgcWDC0GOiy130wL213Y+EvftL 74fySXt/IwXr/hkkfn7Tg2s+EK4bl2C7goHXDZja13BV4bXIrOGSZqEz/0gKZ36M3L7F OA6x1ULdK3uArS/OjrOs+nnUM8rVmmoRYXQlS6Dm18a98t9Ab2PC9UGRXHhITcHOD0nx 4yiw== 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:mime-version :content-transfer-encoding; bh=bs8p7jBvxim/Kr15A2OV4dN2/Mya/1qDXohd6hFoZU8=; b=wZ5KrEDPq5V4W1gK6NwAlC6px8bxoATmbZZb851iaG9ik20vdKcrHy2h9Di/OnbG6N TaeXEn0cT0MqgFaQ9l/UdU1qSJ8G4yusdjwK4JIBeCDm8lio5aSRrq/f6ujpObkGhTk9 bcrrzPDtFsTZmhauYVCpe86hePtE73zxHHsVKuzhv5bkclXWtQzSipUAlrkS9up9c9hd dH3VUKikwSLkwMV8L3offaeUcO4yKu6E7EgKLPwj/50feJ6CsbS3238IpaIEOZpwyT4J Sz3k5+ZvU9LQ9SsKXGeT8tN/7M/wvTd5n/ySkqDnVsAP/Cp8pTp62UdQaRSTTzY2YY6A zd+Q== X-Gm-Message-State: AOAM533UW3/r+INUVR8OAy5GLLzNKqHSQFl5qjtXTn4iyLALd8lVR6+R QIbElTYEK7RM6Rdbt+o2/K0nnDJd9w== X-Google-Smtp-Source: ABdhPJwTWlyXVR1PJUb+0Q0cITf1GXZ/W7/ofK4VM3wAjnkormgd23RTaJ/t4CCcN+48liNtzjCifw== X-Received: by 2002:a63:b252:: with SMTP id t18mr4415027pgo.14.1632406219483; Thu, 23 Sep 2021 07:10:19 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Sep 2021 07:10:18 -0700 (PDT) From: Pingfan Liu To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Pingfan Liu , Sumit Garg , Catalin Marinas , Will Deacon , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Marc Zyngier , Kees Cook , Masahiro Yamada , Sami Tolvanen , Petr Mladek , Andrew Morton , Wang Qing , "Peter Zijlstra (Intel)" , Santosh Sivaraj Subject: [PATCHv2 0/4] watchdog_hld cleanup and async model for arm64 Date: Thu, 23 Sep 2021 22:09:47 +0800 Message-Id: <20210923140951.35902-1-kernelfans@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210923_071021_576109_B92BE52F X-CRM114-Status: GOOD ( 15.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org hard lockup detector is helpful to diagnose unpaired irq enable/disable. Sumit has tried with a series, and the last one is V5 [1]. Since it lasts a long time without any update, I takes a retry, which addresses the delay intialization of watchdog_hld. ( To: Sumit, I think the main body of [4/4] is contributed from you,so I keep you as the author, please let me know if you dislike it and my modification.) There is an obstacle to integrate arm64 hw perf event into watchdog_hld. When lockup_detector_init()->watchdog_nmi_probe(), on arm64, PMU is not ready until device_initcall(armv8_pmu_driver_init). And it is deeply integrated with the driver model and cpuhp. Hence it is hard to push the initialization of armv8_pmu_driver_init() before smp_init(). But it is easy to take an opposite approach by enabling watchdog_hld to get the capability of PMU async. The async model is achieved by expanding watchdog_nmi_probe() with -EBUSY, and a re-initializing work_struct which waits on a wait_queue_head. In this series, [1-2/4] are trivial cleanup. [3-4/4] is for this async model. v1 > v2: uplift the async model from hard lockup layer to watchdog layter. The benefit is simpler code, the drawback is re-initialize means wasted alloc/free. [1]: http://lore.kernel.org/linux-arm-kernel/1610712101-14929-1-git-send-email-sumit.garg@linaro.org Cc: Sumit Garg Cc: Catalin Marinas Cc: Will Deacon Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Marc Zyngier Cc: Kees Cook Cc: Masahiro Yamada Cc: Sami Tolvanen Cc: Petr Mladek Cc: Andrew Morton Cc: Wang Qing Cc: "Peter Zijlstra (Intel)" Cc: Santosh Sivaraj To: linux-arm-kernel@lists.infradead.org To: linux-kernel@vger.kernel.org *** BLURB HERE *** Pingfan Liu (3): kernel/watchdog: trival cleanups kernel/watchdog_hld: clarify the condition in hardlockup_detector_event_create() kernel/watchdog: adapt the watchdog_hld interface for async model Sumit Garg (1): arm64: Enable perf events based hard lockup detector arch/arm64/Kconfig | 2 ++ arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/perf_event.c | 11 +++++++-- arch/arm64/kernel/watchdog_hld.c | 36 +++++++++++++++++++++++++++ drivers/perf/arm_pmu.c | 5 ++++ include/linux/nmi.h | 5 +++- include/linux/perf/arm_pmu.h | 2 ++ kernel/watchdog.c | 42 +++++++++++++++++++++++++++----- kernel/watchdog_hld.c | 5 +++- 9 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 arch/arm64/kernel/watchdog_hld.c