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 X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E14AC433B4 for ; Thu, 13 May 2021 14:08:35 +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 41B72613C3 for ; Thu, 13 May 2021 14:08:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41B72613C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@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 9B26717E3; Thu, 13 May 2021 16:07:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9B26717E3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1620914912; bh=Ro6Bi02vIeUjBdOwn5NLFSzQb8eYW0cHHCNWe6dCxG4=; h=Subject:To:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IiB6bYlu4fyf36/ncGREGIHcnVYggTpfL0No6jCHda67KTFg6lQ5OnvTY6MvQ4Ijz ORSfmU0OT2LLNO8E/SYXk9z8bAQ+nz/MIzkdCHPn9TxCora9d08wV27T+Hl8pJujJN hkjhkpVRkoF94/7OwQnzTPZFJOZVOqfUwjMshxnQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 445E6F80425; Thu, 13 May 2021 16:07:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CC443F8042F; Thu, 13 May 2021 16:07:12 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EB6E1F8013A for ; Thu, 13 May 2021 16:07:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EB6E1F8013A IronPort-SDR: xdAgq4cZq94pCl6vLqDYuAPekk2AHUAnRMbS+eZPrJxpYGTsgVhwQpZnEJgIdBX0OmnK2zobv1 W9O/yK+j9+2w== X-IronPort-AV: E=McAfee;i="6200,9189,9982"; a="187369199" X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="187369199" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 07:06:57 -0700 IronPort-SDR: spygRTR7hTD0K6n6pYEZgU0jOp4tBMlZsK3yKsffsPKl+a2+BTgwU7i/OMk9/726iovkmkn/yq N/M8dnh4FWNA== X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="623646691" Received: from aslawinx-mobl.ger.corp.intel.com (HELO [10.237.180.115]) ([10.237.180.115]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 07:06:56 -0700 Subject: Re: no_period_wakeup, axfer and --sched-model=timer To: Takashi Iwai , Jaroslav Kysela , "alsa-devel@alsa-project.org" , Cezary Rojewski References: <687f9871-7484-1370-04d1-9c968e86f72b@linux.intel.com> <20210513132520.GA109626@workstation> <954a2bc9-f6aa-6c5f-c3f1-62400f22cb3f@linux.intel.com> <20210513135955.GA124922@workstation> From: =?UTF-8?Q?Amadeusz_S=c5=82awi=c5=84ski?= Message-ID: <3fb3270e-3deb-3ee3-a95b-b777b89e7d30@linux.intel.com> Date: Thu, 13 May 2021 16:06:53 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210513135955.GA124922@workstation> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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 5/13/2021 3:59 PM, Takashi Sakamoto wrote: > On Thu, May 13, 2021 at 03:37:02PM +0200, Amadeusz Sławiński wrote: >> On 5/13/2021 3:25 PM, Takashi Sakamoto wrote: >>> Hi, >>> >>> On Thu, May 13, 2021 at 01:34:25PM +0200, Amadeusz Sławiński wrote: >>>> I was checking some stuff relater to NO_PERIOD_WAKEUP and noticed that axfer >>>> has support for using either --sched-model=irq or --sched-model=timer. >>>> However from few quick tests it seems like it doesn't work? >>>> >>>> $ aplay -l >>>> **** List of PLAYBACK Hardware Devices **** >>>> card 0: PCH [HDA Intel PCH], device 0: ALC283 Analog [ALC283 Analog] >>>> Subdevices: 1/1 >>>> Subdevice #0: subdevice #0 >>>> >>>> >>>> When using --sched-model=irq it transfers data until I press Ctrl+C >>>> >>>> $ axfer transfer playback --sched-model=irq -D hw:0,0 -r 48000 -c2 -f S16_LE >>>> /dev/urandom >>>> PLAYBACK: Format 'Signed 16 bit Little Endian', Rate 48000 Hz, Channels >>>> 'Stereo' >>>> ^CPLAYBACK: Expected 4611686018427387903frames, Actual 163960frames >>>> Aborted by signal: Interrupt >>>> >>>> >>>> However with --sched-model=timer it time outs by itself: >>>> >>>> $ axfer transfer playback --sched-model=timer -D hw:0,0 -r 48000 -c2 -f >>>> S16_LE /dev/urandom >>>> PLAYBACK: Format 'Signed 16 bit Little Endian', Rate 48000 Hz, Channels >>>> 'Stereo' >>>> Fail to process frames: Connection timed out >>>> PLAYBACK: Expected 4611686018427387903frames, Actual 16304frames >>>> >>>> >>>> How well is NO_PERIOD_WAKEUP tested/supported? Is it a bug in axfer or >>>> perhaps some issue in kernel code? >>>> >>>> From some debugging I did, I have my suspicions that it gets stuck on poll >>>> in: >>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/core/pcm_native.c?id=c06a2ba62fc401b7aaefd23f5d0bc06d2457ccc1#n3489 >>>> waiting for runtime->sleep to wake it, but seems like it never happens. >>>> >>>> What do you think? >>> >>> It's a regression added by a commit e5e6a7838b06 ("axfer: return ETIMEDOUT >>> when no event occurs after waiter expiration"), and the -ETIMEDOUT come >>> neither from ALSA PCM core nor alsa-lib. Thanks for your reporting! >>> >>> * https://github.com/alsa-project/alsa-utils/commit/e5e6a7838b06 >>> >>> As a quick fix, please revert the commit. I'll post better fixes later. >>> >>> After the revert, it looks work well under my hardware: >>> >> >> Yes, I can confirm, that it fixes the problem. Thanks for quick workaround! > > That's good. I just filed the better fix. Please apply it with your local > repository instead of the revert patch. > > * alsa-utils: axfer: fix regression of timeout in timer-based scheduling model #88 > * https://github.com/alsa-project/alsa-utils/pull/88 > > Anyway, thank you for reporting the bug. In recent years I've been > working for devices in which no-period-wakeup is unavailable, so I > overlooked the bug so long... > > > Thanks > > Takashi Sakamoto > And provided fix also works, thanks!