Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1022393pxb; Wed, 15 Sep 2021 20:08:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb6fJvzVUxEAek9qOQ/uLomMvoLkWNwY3P4R+LZuo2APcWSYgkCnSuODIxe5jmSRMcI7mi X-Received: by 2002:a5e:990e:: with SMTP id t14mr2619768ioj.75.1631761732751; Wed, 15 Sep 2021 20:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631761732; cv=none; d=google.com; s=arc-20160816; b=qqPLY7GD3JgkIujcjDYnkv3hZ8q6hFT0lyIOhV8Ino1Q3Ow+KfFgPvJFxbNXX0dIbv 9sgp+6XS8oLhYQiBNurxDpI03R0BHG3VRCNvHDwTixCsxBxcjqTxfNQndksl0AIfezsp ot+yz2VQwVFQNHCSbpV9zyxX9By9EWDyh5NOn2g91TEexib7irzg3GwUB5+i4rZAUnT1 eZJLwUM/WX+hk6wx5lyxhnLScKZLa59QLssIydh1xTyhNROlo7QL89cGQgW4XIyTAdGL 95K/8p/+SDRseKXAW8qeEflVSSwt+ftlRbaHzFHwWLHo18EyEgY+Raslj9T4JZtTOJU/ EKlw== 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=ewIrGyvVBlsUzMY/tfpMG8U9MTVOYjLYfX7pFihyo8M=; b=acmEi5SuNYwHBs9HTWzMsbVolYYpcmCxSYKWyVSj+7DIeaIfbLKqwG/IXEfsZczNp7 VHMWLNYM8EWFBf5qkcCkpHT6Z9wvj3WDYVJaUMFkUodsD5As2+Fh4UjE2pv5SDisJihy 6vT9u90tytz5OiVGvKXBloRb6gsBMmvA7iO9K2kb+0pqjq+Yze8rpd9SQ0rsRKa3t3f4 6LnqLj+Rfxg78djbSA1uAsxpiYZXqevnRfQlU4fBKGHD+XyyN6pJ6XadnCegZt9Ccb/I e0/skrwScbRVrQZP4v9kEFYL/KhEiomDb3w/CvMEco3rUeBI8mJo2Zc3oANIcRIT70Tx dQWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iwrhf0PR; 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 z10si1521010ioe.51.2021.09.15.20.08.39; Wed, 15 Sep 2021 20:08:52 -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=iwrhf0PR; 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 S234011AbhIPDJE (ORCPT + 99 others); Wed, 15 Sep 2021 23:09:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27683 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233982AbhIPDJC (ORCPT ); Wed, 15 Sep 2021 23:09:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631761661; 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=ewIrGyvVBlsUzMY/tfpMG8U9MTVOYjLYfX7pFihyo8M=; b=iwrhf0PRvp93IBMV7kch35j84QetJTDrPrJxOXGgcOA3r0t/9c38tipttyuSCvWlJbOcMH xUNhhlwBsKD/UiNNYVs+OqFGeFAN34QlsVob1rME+UhNfEdjtijaJGMTNCqhctsHCgV0P+ mqCaVEsXuMWrmYJ5PRRuoyWokGvabAc= 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-36-iIgzS-9gPpywYjaz4atWZQ-1; Wed, 15 Sep 2021 23:07:39 -0400 X-MC-Unique: iIgzS-9gPpywYjaz4atWZQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3719E362F8; Thu, 16 Sep 2021 03:07:37 +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 EA9CD60C81; Thu, 16 Sep 2021 03:07:26 +0000 (UTC) Date: Thu, 16 Sep 2021 11:07:22 +0800 From: Pingfan Liu To: Peter Zijlstra Cc: Pingfan Liu , linux-kernel@vger.kernel.org, Sumit Garg , Catalin Marinas , Will Deacon , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Marc Zyngier , Julien Thierry , Kees Cook , Masahiro Yamada , Sami Tolvanen , Petr Mladek , Andrew Morton , Wang Qing , Santosh Sivaraj Subject: Re: [PATCH 3/5] kernel/watchdog: adapt the watchdog_hld interface for async model Message-ID: References: <20210915035103.15586-1-kernelfans@gmail.com> <20210915035103.15586-4-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.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 04:02:28PM +0200, Peter Zijlstra wrote: > On Wed, Sep 15, 2021 at 11:51:01AM +0800, Pingfan Liu wrote: > > When lockup_detector_init()->watchdog_nmi_probe(), PMU may be not ready > > yet. E.g. 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 this > > initialization 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 introducing an extra parameter notifier > > of watchdog_nmi_probe(). > > > > Note after this patch, the async model, which is utilized by the next > > patch, does not take effect yet. > > I can't make any sense of what you're trying to do.. > Sorry for a bad expression. what I mean is: this patch [3/5] provides an framework for async model. But since watchdog_nmi_probe() still return 0 or -ENODEV after this patch, the code's behavior is the same as original. Does it make sense to you? > > +static void watchdog_nmi_report_capability(struct watchdog_nmi_status *data) > > +{ > > + /* Set status to 1 temporary to block any further access */ > > + if (atomic_cmpxchg((atomic_t *)&nmi_watchdog_status, -EBUSY, 1) > > + == -EBUSY) { > > But this.. > Oh, check other codes, for a wrapped condition, blanks should be better choice. > > + if (!data->status) { > > + nmi_watchdog_status = 0; > > + lockup_detector_update_enable(); > > + } else { > > + nmi_watchdog_status = -ENODEV; > > + /* turn offf watchdog_enabled forever */ > > + lockup_detector_update_enable(); > > + pr_info("Perf NMI watchdog permanently disabled\n"); > > + } > > + } > > +} > > > @@ -467,7 +494,8 @@ static void watchdog_enable(unsigned int cpu) > > /* Initialize timestamp */ > > update_touch_ts(); > > /* Enable the perf event */ > > - if (watchdog_enabled & NMI_WATCHDOG_ENABLED) > > + if (watchdog_enabled & > > + (NMI_WATCHDOG_ENABLED | NMI_WATCHDOG_UNDETERMINED)) > > and this, are horrible indenting. Ditto. Thanks for your comment and review. Regards, Pingfan