Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3882518pxf; Mon, 29 Mar 2021 14:19:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm50MkC4Si4SgSwrhU+nnAgWWRHIw2kEufIFGm32zgCDlaMsVT4Wm//xfkUkbm7lDijjUy X-Received: by 2002:a17:907:3e9e:: with SMTP id hs30mr30862817ejc.66.1617052781549; Mon, 29 Mar 2021 14:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617052781; cv=none; d=google.com; s=arc-20160816; b=K8Psvi7pzNc6Yl63PYvWPACsc2Gc7BpiN4pC6oEQWaeeeSYYxybUVT3++DhWZgS4Yv MsTSHTX4izJ/Iwg+WrYE2mVbxE0khPfW5fu6wY/GT39Iyyo7bTFcM2onwhNMiHnQPfdF JvUe1/8sO6NqxEiPOGsNXhuORxHh791Fvfzveeyy8e/jbe38VwEVaJkYAgIU3vNfmpoe eseu6filjVGIhxm8wBNkQviGDA6x6uTaes+vRTnZoy3Y29TVh5OS7WawTgJFBjskKzga LznYElgEE2kgglKR18BbrC8mM3SLDCEnOZxv1unkecJGbT5fkNjI6LHpiuFTlaFOsExU n3fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=5TQOBHBNHWs/ZyfokQYDMYWSiKIBj/rHEXaeDdO4aX8=; b=BbohlxcJGjdb0TOPS6B3OYUOEybVevjfu7lmsXwQGiRuWIzGHAcUu1/5vzdLwPO2rJ XN6EXOZXHza74MIg4So9KO5vsZIFB87ZqW5cyIXNjiQnG21YL+poXa96e/77X4aWdzSH bk75L0z6WpOl3UOdg1oDvLJZ4qUnM06S7UzB2lacYubf5585anW0l90pdseEAXc1c0XA 2WbzWND+4QsmPjLHwH33LoshOaYbEAHScjw/B2QZZeFbFCkXf7eOlWlsyqnpN1qJrr7s NkODR9Zw+Fbyw9JHHhTazB55TX6RqVJoe1lP2v4RK8xTZYMZLM+LtA0GzfLsDMAEHHnG EPnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=D8JL9f3H; dkim=neutral (no key) header.i=@linutronix.de; 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=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si13585911eju.631.2021.03.29.14.19.17; Mon, 29 Mar 2021 14:19:41 -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=@linutronix.de header.s=2020 header.b=D8JL9f3H; dkim=neutral (no key) header.i=@linutronix.de; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231124AbhC2VSO (ORCPT + 99 others); Mon, 29 Mar 2021 17:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbhC2VRs (ORCPT ); Mon, 29 Mar 2021 17:17:48 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D039C061574 for ; Mon, 29 Mar 2021 14:17:48 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1617052666; 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=5TQOBHBNHWs/ZyfokQYDMYWSiKIBj/rHEXaeDdO4aX8=; b=D8JL9f3Hwn+k8AMnHiEaYBAmMZ92q3rb6T40EmUKgFawPtTS4yqvdpeWUxagiNhdI4NzFb tgXwgbEUR8bdSJ5h3LjWj4PE6AEu7U19cdSD7Ne+YEqvaWw2Wu0T4dDmTHeQKSi7cXhqZ7 lXkQJORLbFez//DMly0P8TCOuF4vxx0SQmjqES8ljqypXUXqx99lw/8goTccD6OD7Cm2xU /HcsRA8YJCzAiD3Grw1NhCCwm8qG38kFYVIehThhw25+3c1NRvC+/qak9WhwGuqd/VlGeS CES0AiTQtzN77V2HtzBcXkM3cKZ7jJLmRJ3drLdMtj8oYRXjhqiKMSGNAroqCQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1617052666; 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=5TQOBHBNHWs/ZyfokQYDMYWSiKIBj/rHEXaeDdO4aX8=; b=rDs4H3tCT/xbUAVbCSYCDuykq/Ao0xU7+CmI6n4/pR9C+2RXGZuFmICctid06O99flBuU4 /bOHEpR+Aw01c1CQ== To: Jindong Yue Cc: linux-kernel@vger.kernel.org, fweisbec@gmail.com, mingo@kernel.org Subject: Re: [PATCH] tick/broadcast: Allow later probed device enter oneshot mode In-Reply-To: <20210329052555.24487-1-jindong.yue@nxp.com> References: <20210329052555.24487-1-jindong.yue@nxp.com> Date: Mon, 29 Mar 2021 23:17:46 +0200 Message-ID: <878s657j7p.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 29 2021 at 13:25, Jindong Yue wrote: > /* > * Debugging: see timer_list.c > @@ -115,8 +116,20 @@ void tick_install_broadcast_device(struct clock_event_device *dev) > * notification the systems stays stuck in periodic mode > * forever. > */ > - if (dev->features & CLOCK_EVT_FEAT_ONESHOT) > + if (dev->features & CLOCK_EVT_FEAT_ONESHOT) { > tick_clock_notify(); If the kernel runs in oneshot mode already, then calling tick_clock_notify() does not make sense. > + /* > + * If new broadcast device is installed after high resolution > + * timers enabled, it can not switch to oneshot mode anymore. This is not restricted to high resolution timers. The point is that the mode is ONESHOT which might be either HIGHRES or NOHZ or both. > + */ > + if (tick_broadcast_oneshot_active() && > + dev->event_handler != tick_handle_oneshot_broadcast) { How would that condition ever be false for a newly installed device? > + tick_broadcast_switch_to_oneshot(); > + } So what you really want is: if (!(dev->features & CLOCK_EVT_FEAT_ONESHOT)) return; if (tick_broadcast_oneshot_active()) { tick_broadcast_switch_to_oneshot(); return; } tick_clock_notify(); Thanks, tglx