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 D4A13C433EF for ; Tue, 28 Sep 2021 08:59:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4F7261153 for ; Tue, 28 Sep 2021 08:59:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B4F7261153 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EF37B168F; Tue, 28 Sep 2021 10:58:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EF37B168F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1632819566; bh=68PDx5Rcn+M1vOV43kPfG94rABUXr+k9RihyxcMxDz8=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=L1Nw0uFJCRmTBefW48f3T/209yyu11VL+4zm/pzFWxFBi+CY2Tg4+QFXWYxdXRsWE zWLDXQVCEu5geUjGhhrFwLC4b2lHYVwLWzscuFVdqS4bj+r61wJOD15Oj6vK93RCwC OG7h8mMvX+GGmtU8OsMN9JsTwZT97rE4LeqIhlM8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7C036F800DE; Tue, 28 Sep 2021 10:58:35 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DBB7CF8032C; Tue, 28 Sep 2021 10:58:33 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3BB54F800DE for ; Tue, 28 Sep 2021 10:58:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3BB54F800DE Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="QMEc64ey"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="4WM07OBK" 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 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 Cc: Peter Zijlstra , alsa-devel@alsa-project.org, LKML , Takashi Iwai X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 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