From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABAFEC433EF for ; Tue, 28 Sep 2021 08:58:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 884806113E for ; Tue, 28 Sep 2021 08:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239705AbhI1JAK (ORCPT ); Tue, 28 Sep 2021 05:00:10 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:54798 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239631AbhI1JAI (ORCPT ); Tue, 28 Sep 2021 05:00:08 -0400 Received: from relay1.suse.de (relay1.suse.de [149.44.160.133]) by smtp-out1.suse.de (Postfix) with ESMTP id 7C24922103; Tue, 28 Sep 2021 08:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1632819508; 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=JsyfURuFjNsumK4n2djwc/yAX5JOSafSOAiNmTR3xaY=; b=QMEc64ey4DyE0EEZSZR0RgGMbnvTvR9yn2bC4YEppTiOFUKW5MFkTEHtCe5fXjR4h4CMET ArTpFvagZRADuxLwt0NvY0kch1exvb8OH9xA40Gw1rfjYHKf6j25UfrTx1gpJkJkv8bz4e 7joD9OKaIzuuUzNFJwtg02jk6ChrJPM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1632819508; 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=JsyfURuFjNsumK4n2djwc/yAX5JOSafSOAiNmTR3xaY=; b=4WM07OBKH7KWukXIAWkVjVjC4re1CwV8X9PMsTUCFPKrZcoXB4RmN4xXtk+1JEXFUG56Jf HU7HR5lzi3hOZpDA== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay1.suse.de (Postfix) with ESMTP id 67E0125D4D; Tue, 28 Sep 2021 08:58:28 +0000 (UTC) Date: Tue, 28 Sep 2021 10:58:28 +0200 Message-ID: From: Takashi Iwai To: Thomas Gleixner Cc: LKML , Peter Zijlstra , alsa-devel@alsa-project.org, Takashi Iwai , Jaroslav Kysela Subject: Re: [patch 04/11] ALSA: pcsp: Make hrtimer forwarding more robust In-Reply-To: <20210923153339.623208460@linutronix.de> References: <20210923153311.225307347@linutronix.de> <20210923153339.623208460@linutronix.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Sep 2021 18:04:25 +0200, Thomas Gleixner wrote: > > The hrtimer callback pcsp_do_timer() prepares rearming of the timer with > hrtimer_forward(). hrtimer_forward() is intended to provide a mechanism to > forward the expiry time of the hrtimer by a multiple of the period argument > so that the expiry time greater than the time provided in the 'now' > argument. > > pcsp_do_timer() invokes hrtimer_forward() with the current timer expiry > time as 'now' argument. That's providing a periodic timer expiry, but is > not really robust when the timer callback is delayed so that the resulting > new expiry time is already in the past which causes the callback to be > invoked immediately again. If the timer is delayed then the back to back > invocation is not really making it better than skipping the missed > periods. Sound is distorted in any case. > > Use hrtimer_forward_now() which ensures that the next expiry is in the > future. This prevents hogging the CPU in the timer expiry code and allows > later on to remove hrtimer_forward() from the public interfaces. > > Signed-off-by: Thomas Gleixner > Cc: alsa-devel@alsa-project.org > Cc: Takashi Iwai > Cc: Jaroslav Kysela Thanks, applied now to sound git tree. Takashi