Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1189327pxb; Thu, 16 Sep 2021 01:37:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy8y2tv2lKZd+Yq9K3dKKNV1tPy4iU8VwaYrgeoU+Tgy5WmL12kpgrAvMCiOOWjZ6NbG4H X-Received: by 2002:a6b:e905:: with SMTP id u5mr3322857iof.116.1631781423867; Thu, 16 Sep 2021 01:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631781423; cv=none; d=google.com; s=arc-20160816; b=tEAUzfQBFVO8wOFbrlvO4mmili/7Y5kRYpLWxXyxLQRCcjnivRxXsmtzlkOsbmg8wx pnJuMe7q8zEjQ4i1BmYzWNjjdxLD68Ysdqpj36LJ8oAJVSloXRAIHOeiuKh8jAf3tQ/5 LeEW+Ls4Hxf9w+vAbA0BSIvzc+GaWoEZovvLoKr5XCv3NT/o8bg32nTIIkPMxfoUVPJh yLUOvQKAcjjCypy4CxJXBOKndAPI7LHNJPs334iWWOgpGMQz+UffPlTc49nB1KtxezNh wKSwSTkR0X65IunL3+y2pV26uS2DVIhVIWsXtc5l1vh+1irkuFnLzrV8pelUOtVkVRgV HRnQ== 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=79mscK8roTgwKozDJaNFGPb9v79JgIWvwk3WR5On0oU=; b=vWcBoeTl3kHOK44ELZATt4N+naRri8HnDeItGwv2N0svcBwZcpernzsp4LusBGobYr CrWWIboj2yaYzFoWnZ7vfE2aqCTj1nptfCQjdqDqoJyfSqB3whr0e/Fx8o2xjiJahHbg hGxF36x99Ex0G6luimJAtrvfyQ+gzHv4OWX2Sr9YxWU1eQuTXTopg2AuIz9xxh9CGcpg 6F7KIkdhxdxjpDsgEXSz+u1hbhQ+oEZaW8s11k/Vx9nrPkeBtq9c9S5cI/dOr/oN2aXo D4uflEgigwYpwTrIforq5ZUzCMxPaHXDrfHpqW5i8E74VQBcOZ4KbhtnRupb0EGXQZW5 YmoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TlnPBdyY; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o16si1987363ilh.153.2021.09.16.01.36.52; Thu, 16 Sep 2021 01:37:03 -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=@suse.com header.s=susede1 header.b=TlnPBdyY; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235160AbhIPIhc (ORCPT + 99 others); Thu, 16 Sep 2021 04:37:32 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:54748 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231273AbhIPIhb (ORCPT ); Thu, 16 Sep 2021 04:37:31 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id AC1A71FEB1; Thu, 16 Sep 2021 08:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1631781370; h=from:from:reply-to: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=79mscK8roTgwKozDJaNFGPb9v79JgIWvwk3WR5On0oU=; b=TlnPBdyYJHEHdBkGw6SFRCA4CswKRzdbRyeubemAwG6mbd3ZoOka7ByDwr+fxtwJBVy0EX uEx3SRbyV8evPNoCZjhRt0amIAdNLlSR+y51WUyL/cDQ1HHgoF42XT5ZIEweTyJ316+YZd F0oXxS4GAtTSdTRP6nx/qSj6GrLmK0I= Received: from suse.cz (unknown [10.100.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8A988A3BA4; Thu, 16 Sep 2021 08:36:10 +0000 (UTC) Date: Thu, 16 Sep 2021 10:36:10 +0200 From: Petr Mladek To: Pingfan Liu Cc: 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 must wait in a loop until someone else stop it and read the exit code. 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. Best Regards, Petr