Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2393282pxb; Fri, 17 Sep 2021 08:48:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFnrFj4a4rMBDrRbvylGUFG00Amggu6kKtUd2kLwOCBb8OYDebWFw5Lo0pj1AVjHr2Djz9 X-Received: by 2002:a02:7b24:: with SMTP id q36mr9143954jac.130.1631893685273; Fri, 17 Sep 2021 08:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631893685; cv=none; d=google.com; s=arc-20160816; b=IlxlaRJ3hNYRdPRaKWCfQJWfgSGV0D/jRp8QcWZDv1WgnD+x0aDnN5/JT4Zngh0w7P ph6u0gQE/e8t2KH7/G7GHRqpHUNhcvaurHxdWpZmGCkyriAIWsFEcAKh+nn7zhVaTTok PMbKdUaTMElCTUphg1LGnQjwLY0RBW5QwMEl9phZOCCI8CIq69lD/MTxqU6ffhm9JO3H GcK3jnRbO+CDTD2YoRCT9n81Q7suGicOWJ25obrjrfQuCreHqBLwr+G1cp0n7t20/eo4 bTyTHBhXn+4DT11oo45gUOkyQM/kG2mOi4jDpzhTYHJTCT4VtyQfYy2qLTk9f96u4OR0 lfYg== 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=noifM8XXyMwbbFJd5i/42aORUxxVOt7zx3PNERa/hzo=; b=1LqYXcgrb88zVtvLfrPaS1Bqi3hV8Bsb3Tz62AQwJCRBRKhkKcSShz8HsbaUL1epG8 r7gJNrs8IHriISCDraDQabTqGKwgvLsSCXkW1b72YQwahYyRkgoxuZg6ft12wi6nHMKH HM9s1t4vUjIZMoU6BCAFPHaW/TXJG8tsdRRafC1DiBo2vtQ4uLopt/c4CCxzfT+vE4ii bjaojiLgkZkxLkz1SSjn7Nw2Cb4PkvMq88QMdJDAmnPR/Jco9aYZuuIoYK9PZ41LvePZ KhR1vzmqpMK8/WCh/JaNzykndvU/p20/kQfrrPa2FJoPVdoSWMXzo0WZQAxO/Ed2P0/C mzZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gXcJ2+6I; 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 m1si6499365ilu.13.2021.09.17.08.47.54; Fri, 17 Sep 2021 08:48:05 -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=gXcJ2+6I; 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 S243174AbhIQPng (ORCPT + 99 others); Fri, 17 Sep 2021 11:43:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24152 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbhIQPne (ORCPT ); Fri, 17 Sep 2021 11:43:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631893331; 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=noifM8XXyMwbbFJd5i/42aORUxxVOt7zx3PNERa/hzo=; b=gXcJ2+6I13euwmHBy91yR0tcjHRecQNqV5Wj5NU82osIossZBsognSoI5hhV2674J7pZgG 5yjjFW32AK+0m4rK+igj/Ri25Y+3UUnZeNPlHuZqKpJOyDAbcFsrXQ94r+Y0JD1IuDFr4e gCvFKcnRViOO+o38WLUTT3vo++Y8Wtc= 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-519-UdQGdhi9NgW7pwDA-y5Zeg-1; Fri, 17 Sep 2021 11:42:10 -0400 X-MC-Unique: UdQGdhi9NgW7pwDA-y5Zeg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 26B19802C92; Fri, 17 Sep 2021 15:42:07 +0000 (UTC) Received: from piliu.users.ipa.redhat.com (ovpn-8-17.pek2.redhat.com [10.72.8.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA3805C1A1; Fri, 17 Sep 2021 15:41:35 +0000 (UTC) Date: Fri, 17 Sep 2021 23:41:31 +0800 From: Pingfan Liu To: Petr Mladek 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 , Andrew Morton , Wang Qing , "Peter Zijlstra (Intel)" , 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.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 16, 2021 at 10:36:10AM +0200, Petr Mladek wrote: > On Thu 2021-09-16 10:29:05, Petr Mladek wrote: > > On Wed 2021-09-15 11:51:01, 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. > > > > This is another cryptic description. I have probably got it after > > looking at the 5th patch (was not Cc :-( > > > > > The async model is achieved by introducing an extra parameter notifier > > > of watchdog_nmi_probe(). > > > > I would say that the code is horrible and looks too complex. > > > > What about simply calling watchdog_nmi_probe() and > > lockup_detector_setup() once again when watchdog_nmi_probe() > > failed in lockup_detector_init()? > > > > Or do not call lockup_detector_init() at all in > > kernel_init_freeable() when PMU is not ready yet. > > BTW: It is an overkill to create your own kthread just to run some > code just once. And you implemeted it a wrong way. The kthread I had thought about queue_work_on() in watchdog_nmi_enable(). But since this work will block the worker kthread for this cpu. So finally, another worker kthread should be created for other work. But now, I think queue_work_on() may be more neat. > must wait in a loop until someone else stop it and read > the exit code. > Is this behavior mandotory? Since this kthread can decide the exit condition by itself. And a quick through static int kthread(void *_create), I am not aware of any problem with it. > The easiest solution is to queue a work into system_wq for this. > > I was not Cc for the 5th patch, so I write it here. > Sorry for the inconvenience and Cc you now in case that you have further comments. I will cc you in the next version. Appreciate for all of your suggestions and comments Thanks, Pingfan