Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1386447ybj; Tue, 5 May 2020 19:46:46 -0700 (PDT) X-Google-Smtp-Source: APiQypKtzAVOeajwzS9MiaxilklmS2e7/2WUWqd/+K3yN6yDWCZwXEqZi8pbgZPMW2ugOZDKinc7 X-Received: by 2002:aa7:d2d0:: with SMTP id k16mr5338394edr.354.1588733205964; Tue, 05 May 2020 19:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588733205; cv=none; d=google.com; s=arc-20160816; b=KZDPhruloUFevTXqkzY/EcviPeiiJgds5H4T6qJPwEIMei8REZfw2MtjaRwh0vK+jn GaAOPl8NeDxye+fqLxG0MW1zKKXMeibANlyVWpIXGB1RMEqltujPanqL6xZRypXcyP9v oTdkmeBRNRcZ5Wi2h33cv64fZsbxCW0INMGqjq/EoS//n+gk3ZTV93Jn0vh++brCWwkw f0Cbz9bfNwCyRXBhvyP8khm1TGNT44Bq9pw1En0XEoaAiiTNXr7eZytbUSMeOexGolrB rKwnuEemmK3NF5wk4XaxuOGRkCm05Z6Cn16PVSOjPioCQfkwP2XjYOMG8NBgYeJPNX/F ZdeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=ITHPhZn7zlD7txcI0qhWvp2d742uyF13YEKeEaT5HN0=; b=0/36zW+b2foT5yTFaVq5SSA8fkmJaj/0cw1wyZsHnskR3u+O1f1AKn82Ajejed8Xb1 e9d9cLgUy7c7IGhWHJVPrefX8+9Zc5xdOzaax4DjAdsxQ/mx+JWFgIt06PUzzsuaxPNZ zXXxzGRAKsZUCep/BkppS2dHcZM8xOK93yYKwIBTN/OU+lTKcuxiAuSFLv9x/V4kMqae nPCLbfooaOeSKYZ/biDyhb2Rs3RN7NwiV1Py3tWdhhWUCzLGhuXmZmcXzS1TEpd9cxdd c4qOFVjQvpVPsWKVQUwEvH7MOUnXILL48pPJ44cST1eS4sPhyguQFoYGU2vS60fzvEe+ 4o7Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si309194ejm.361.2020.05.05.19.46.08; Tue, 05 May 2020 19:46:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729892AbgEFCec (ORCPT + 99 others); Tue, 5 May 2020 22:34:32 -0400 Received: from mga09.intel.com ([134.134.136.24]:54476 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729509AbgEFCea (ORCPT ); Tue, 5 May 2020 22:34:30 -0400 IronPort-SDR: CRH3Fk7T+ROORJ08/gEIIwdQZRN8h3noOwHtgvrJO25c8co4xUizl4HwAqQOCbq2HslfIDYwSJ X6PMIsPKqhPA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2020 19:34:28 -0700 IronPort-SDR: zyDBtX2S7VPVpvrTqzdmbBJHTOdw/2LBbG6F2vT1/GmoNDTnEYfNNw4D+Q2se78qNDxVnJn81L +Sjg6JTn6qMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,357,1583222400"; d="scan'208";a="338853107" Received: from nxiao-mobl.ccr.corp.intel.com (HELO [10.254.215.171]) ([10.254.215.171]) by orsmga001.jf.intel.com with ESMTP; 05 May 2020 19:34:24 -0700 Subject: Re: [PATCH] ASoC: Intel: sst: ipc command timeout To: "Lu, Brent" , "Rojewski, Cezary" , Pierre-Louis Bossart , "alsa-devel@alsa-project.org" Cc: Kate Stewart , "linux-kernel@vger.kernel.org" , "clang-built-linux@googlegroups.com" , Greg Kroah-Hartman , Takashi Iwai , Liam Girdwood , Richard Fontana , Mark Brown , Thomas Gleixner , Allison Randal , "amadeuszx.slawinski@linux.intel.com" References: <1586506705-3194-1-git-send-email-brent.lu@intel.com> <4f495cf1-4740-cf3b-196f-cc850c503b43@linux.intel.com> From: Keyon Jie Message-ID: <4623d6b9-8dc6-b301-c8ff-74dfb6baf2a3@linux.intel.com> Date: Wed, 6 May 2020 10:35:10 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/22/20 12:16 AM, Lu, Brent wrote: >> >> Regs width difference between BDW and BYT comes from specification. BDW >> has IPC registers which are 32 wide. This fact ain't exactly the reason to modify >> sst_shim32_read64. >> >> I'm sharing Amadeo's point of view. Your change should slow down execution a >> bit - but that might be just what handlers needed to make everything work again. >> Debug prints also slow down the execution what could have prevented you from >> spotting the real problem. >> Let's ignore the memcpy stuff for a moment - could you focus on elaborating >> the scenario where such issue occurs? Your initial commit message also skips >> important bits such as platform used when reproducing and so on, please add >> them. >> >> Thanks, >> Czarek > > This issue is reported to happen on BYT Chrome book (rambi) on Chrome-v4.4 > branch after changing toolchain from clang10 to clang11. > > The reproduce step is simple. Just run arecord multiple times (<10) then you will > see error message for hw_params ioctl failure. > > $ arecord -D hw:1,0 -f S16_LE -c 2 /dev/null > $ ctrl+c > > The error message suggests the stream commit (IPC_IA_ALLOC_STREAM, 0x20) IPC > command failed due to timeout but the msg id field of ipcd read after the timeout is > also 0x20. It seems to me that the command is success but the host driver does not > know it for some reason. > > 2020-03-15T23:02:06.614151+00:00 ERR kernel: [ 852.023766] baytrail-pcm-audio baytrail-pcm-audio: ipc: --message timeout-- ipcx 0x2220 isr 0xf0020 ipcd 0x2220 imrx 0x0 > 2020-03-15T23:02:06.614209+00:00 ERR kernel: [ 852.023796] baytrail-pcm-audio baytrail-pcm-audio: ipc: error stream commit failed > 2020-03-15T23:02:06.614218+00:00 ERR kernel: [ 852.023813] Baytrail Audio: PCM: failed stream commit -110 > 2020-03-15T23:02:06.614225+00:00 ERR kernel: [ 852.023832] baytrail-pcm-audio baytrail-pcm-audio: ASoC: baytrail-pcm-audio hw params failed: -110 > > I add some messages to make the log easier to read. You can check the gerrit link if you > are interested: > https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2131507 > > In the test patch I read the SST_IPCD register in sst_byt_irq_thread() twice and found > the value could be different. The IPC_IA_FREE_STREAM(0x21) seems to be the last IPC > command sent in the pcm_release of previous arecord command. > > [ 125.009724] sound pcmC1D0c: snd_pcm_release: > [ 125.009732] baytrail-pcm-audio baytrail-pcm-audio: ipc_tx_message: header 0x8000000000000221 wait 1 > [ 125.009760] baytrail-pcm-audio baytrail-pcm-audio: byt_tx_msg: header 0x8000000000000226 > [ 125.009803] baytrail-pcm-audio baytrail-pcm-audio: sst_byt_irq_thread: header 0x297 > [ 125.009823] baytrail-pcm-audio baytrail-pcm-audio: byt_tx_msg: header 0x8000000000000221 > [ 125.009872] baytrail-pcm-audio baytrail-pcm-audio: sst_byt_irq_thread: header 0x297 > [ 125.010442] baytrail-pcm-audio baytrail-pcm-audio: sst_byt_irq_thread: header 0x80000000000c2226 > [ 125.010456] baytrail-pcm-audio baytrail-pcm-audio: sst_ipc_reply_find_msg: not match, msg header 0x8000000000000221 > [ 125.010511] baytrail-pcm-audio baytrail-pcm-audio: sst_byt_irq_thread: header 0x8000000000000221 > [ 125.011355] baytrail-pcm-audio baytrail-pcm-audio: tx_wait_done: ipc success, header 0x8000000000000221 > [ 125.380506] sound pcmC1D0c: snd_pcm_capture_open: > [ 125.380544] sound pcmC1D0c: snd_pcm_capture_ioctl1: INFO > [ 125.380554] sound pcmC1D0c: snd_pcm_capture_ioctl1: PVERSION > [ 125.380561] sound pcmC1D0c: snd_pcm_capture_ioctl1: TTSTAMP > [ 125.380581] sound pcmC1D0c: snd_pcm_mmap: > [ 125.380622] sound pcmC1D0c: snd_pcm_mmap: > [ 125.380648] sound pcmC1D0c: snd_pcm_capture_ioctl1: INFO > [ 125.380717] sound pcmC1D0c: snd_pcm_capture_ioctl1: HW_REFINE > [ 125.380737] sound pcmC1D0c: snd_pcm_capture_ioctl1: HW_REFINE > [ 125.380766] sound pcmC1D0c: snd_pcm_capture_ioctl1: HW_REFINE > [ 125.380779] sound pcmC1D0c: snd_pcm_capture_ioctl1: HW_REFINE > [ 125.380789] sound pcmC1D0c: snd_pcm_capture_ioctl1: HW_REFINE > [ 125.380799] sound pcmC1D0c: snd_pcm_capture_ioctl1: HW_REFINE > [ 125.380808] sound pcmC1D0c: snd_pcm_capture_ioctl1: HW_REFINE > [ 125.380815] sound pcmC1D0c: snd_pcm_capture_ioctl1: HW_PARAMS > [ 125.380839] baytrail-pcm-audio baytrail-pcm-audio: ipc_tx_message: header 0x8000000000642220 wait 1 > [ 125.380854] baytrail-pcm-audio baytrail-pcm-audio: byt_tx_msg: header 0x8000000000642220 > => write IPC_IA_ALLOC_STREAM message (0x20) to SST_IPCX > [ 125.380931] baytrail-pcm-audio baytrail-pcm-audio: sst_byt_irq_thread: header 0x8000000000000221 > => read message reply from SST_IPCD and an IPC_IA_FREE_STREAM(0x21) is returned > [ 125.380942] baytrail-pcm-audio baytrail-pcm-audio: sst_byt_irq_thread: ipcd 0x8000000000602220 > => read SST_IPCD again, this time the message id is what we are expected (0x20) Looks there is race between the previous stream stop and the current stream start here. Can you help try changing the sst_byt_stream_start/stop() from 'nowait' mode to 'wait' mode, and see if the issue can be reproduced with it? Thanks, ~Keyon > [ 125.380948] baytrail-pcm-audio baytrail-pcm-audio: sst_ipc_reply_find_msg: not match, msg header 0x8000000000642220 > [ 125.681171] baytrail-pcm-audio baytrail-pcm-audio: tx_wait_done: ipc timeout, header 0x8000000000642220 > [ 125.681204] baytrail-pcm-audio baytrail-pcm-audio: ipc: --message timeout-- ipcx 0x2220 isr 0x50020 ipcd 0x2220 imrx 0x0 > [ 125.681212] baytrail-pcm-audio baytrail-pcm-audio: ipc: error stream commit failed > [ 125.681217] Baytrail Audio: PCM: failed stream commit -110 > [ 125.681223] baytrail-pcm-audio baytrail-pcm-audio: ASoC: baytrail-pcm-audio hw params failed: -110 > > Regards, > Brent >