Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4700971pxb; Tue, 28 Sep 2021 01:59:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2KYLv7kc7TbCaazg2xr3qRp8XrY+1dTfdNOeGYVFG9y2k927RLbkEySWj4tfx1TDn/7LK X-Received: by 2002:a17:902:9009:b0:13b:9cae:5dd7 with SMTP id a9-20020a170902900900b0013b9cae5dd7mr3739196plp.53.1632819568015; Tue, 28 Sep 2021 01:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632819568; cv=none; d=google.com; s=arc-20160816; b=pssF5cXjquJ1Is0e3wYvJF01KoQ6xzye74JMjkq/w6+EtBfS5umJRNswe9WG9OEIXu tPsQFh2JReTWx4DlZ5C2CEoTed/9LhkjJVrWtPf1KVqCu3qFv4ob/jBpv/FxIOAiYgmI mrRbPmXdaqXbeSkzvQMns2sb5DDsSrv28zpLemtosNbrbydAtKptR4fqBcQW52TSl1AH CW/eHHCnEOHdcWS8ttnEuDW2SrIublWwNHfx9NvbWTA6EbXrGIH/0eZisIxkzXMRwZBB YoIBVUTj/+M2E1Ldoms3Go+okWiTAsBWIfunJHh/eAvTd06s+RpuquTqkeP9axpdhKxp i2oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=JsyfURuFjNsumK4n2djwc/yAX5JOSafSOAiNmTR3xaY=; b=K8BFUZJcyEqnLVOobaWrI7YgDvXTUvJ8nMSAtzx79qinkS+inkk/KB0g8u5HtQijTx Lhk4xFCTkG15tTYGs6X+YprdWFv0cKRAy0NT4pWY9GslfH0TdaD0d0FhQKNQnkW5P9kr 8i4vbbKaTk7a3dgOxSQ2LKHy9eOKhuCioUZNp//Itwvz+XGiPYnEzJynjsXLSuk1FGmI 9GkaUNCaSL/r+A4PLSFWpd35M14VI1LyWFAetMNoP9bZDZ16R3OFQz+6xDTtbIg4NPnC b24C/zDrraAovjWA8/wJM1FbShj36oPpJsgJpDKZh9TsHF21rWKTQJrJs2eGlxipXkSy d+DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=QMEc64ey; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si10949415plp.82.2021.09.28.01.59.15; Tue, 28 Sep 2021 01:59:28 -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.de header.s=susede2_rsa header.b=QMEc64ey; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239664AbhI1JAJ (ORCPT + 99 others); Tue, 28 Sep 2021 05:00:09 -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