Message ID | 20240228074138.23679-1-soxiebing@163.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-84625-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3191160dyb; Tue, 27 Feb 2024 23:43:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXiRHXHK7QYmHzMA3/eG2KNk3ojB5b0C6jjgzmbhnnlKrYulKJrZFnd/ScRp+ByT0kDcU0I2BPdvMea1sSW88Tg/KBeCg== X-Google-Smtp-Source: AGHT+IH2P/iQTC4asityUNLzChEIOdOGfvB1+dgawH4dPKwIaegVJELR2u/xTqClgpjxTwf643Sr X-Received: by 2002:a05:6808:1894:b0:3c1:ae62:e629 with SMTP id bi20-20020a056808189400b003c1ae62e629mr4525355oib.50.1709106190051; Tue, 27 Feb 2024 23:43:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709106190; cv=pass; d=google.com; s=arc-20160816; b=GIL2AosuCOgHe76gNtoyW0bhyRriUkuMNJShSur9w85bRIOP2zvUyB+HtLOuclFHXp J+9hXhxQ5HQeQc6/A1uCeXfda55MRYfbz8SCTYWscQnvoNfJKtJxkc1pd3a1vUIqgQDO oNBubchiORjmN5yGjHowaDiMXF1uHAs+XHvEzofj5F5t/l6Qr+kaKKiKdv+PPXiwXQwV uxeo/1o5WT+GhE+V2IDGCHPaXtS3siNgz8xpHvYgou3dni9sg8B7MNMCipgZB+ZX+5wW 6AtS+hcN3aVJ2M43QUBPZ94z8LFe7iVAPkXNnZqGVskOLtjZjPY5DcNnuGgcPqFBHets Bq7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ZJ1CeXr5L+70RmndFbrJnevySNkuujkOo+h0+Lv9h0U=; fh=R7Xc9hvWtEjCt3C5sdVO7KQynrozGKFf7GKe1BUj1rg=; b=lg6Ni22EHDAeCWmW6ahG0X33Y4cA08qdIyfArAw4bthRzC867NSTgdvyrxiXHzLoMf nj9qiJrT0/jWuBqBwG0SG7r2nsbb+g+X3AdkEveAiDmuo01qcFGkUSqRQVUSgZU3iv7K zJ7EgECOXtGqjU6M6DKMDLjr8M8WB6/4zi172NBLWnwFm+WyYSKB8lW6qMVBbPu+QiCN iQqCDSm6/AIBCK1l6onEz3xkOmnY3gPkwcq5vouGP+JrrZadJWjqxuRg0HP1jTecYofE pBfkr1ZdU4sft91MX2BGIswx0u83KFJFe8xOq2jB22lOJJbzRVOpx8cjro5maDppgtAA agAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=PqujgYET; arc=pass (i=1 spf=pass spfdomain=163.com dkim=pass dkdomain=163.com dmarc=pass fromdomain=163.com); spf=pass (google.com: domain of linux-kernel+bounces-84625-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84625-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l21-20020a637015000000b005dc893fcd81si6946061pgc.29.2024.02.27.23.43.09 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 23:43:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84625-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=PqujgYET; arc=pass (i=1 spf=pass spfdomain=163.com dkim=pass dkdomain=163.com dmarc=pass fromdomain=163.com); spf=pass (google.com: domain of linux-kernel+bounces-84625-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84625-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C5781286A6F for <ouuuleilei@gmail.com>; Wed, 28 Feb 2024 07:42:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CC022560B; Wed, 28 Feb 2024 07:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="PqujgYET" Received: from m15.mail.163.com (m15.mail.163.com [45.254.50.220]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C2CD24B41 for <linux-kernel@vger.kernel.org>; Wed, 28 Feb 2024 07:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.50.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709106141; cv=none; b=MOLG1UGLTevFiMTe9keRDWA5mUl6eLFYJWzaXOQug44CdyxvJYywOgkcU6Gi3WfG2AaWRrI9gf9A17sra48hpbLWd5K7VXd0NDFqGn4cYCI0Z4muFC7ClguNsoaVZAY96GJ12dDdnNQie8Ub3ToAUL3RU3Osb6hMs5/Rh2eAivI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709106141; c=relaxed/simple; bh=u84TQ2oYytZsBuH/zcjVZljLTWPVxv1MJltl+gVYCDc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=jGQ84iyMznqDJH+59ZQJth1Fo/Hd4J4gayLTh/VfRaDUQkVWA1xJQUteamJqaCq7SRH80rjKU7e0aXyePpYG5AIUEjdVVO+ZxRmcJoZ8sd8g4+jq4UECMuLreHpuENLk3HNijeELmrH5QDRO4hWshtVB2MQWsparJOpJ75dYWXw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=PqujgYET; arc=none smtp.client-ip=45.254.50.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version: Content-Type; bh=ZJ1CeXr5L+70RmndFbrJnevySNkuujkOo+h0+Lv9h0U=; b=PqujgYETxj5f7eV9lUrTkoUzayo9LMbSPGWyHOPRvIQDbxPQP1lCJA5gQGeIjU mOrersbX7qIPd8kNbxGZqZSDU/ToKHAHBMu7JpoBQxo7DOOjQjVwUS6OiOfXdzVV 6qq1pkk5xVjb1OQgQlXgMK8qxTXJ45WlpwEL3srKXnuWs= Received: from localhost.localdomain (unknown [111.48.58.12]) by gzga-smtp-mta-g0-3 (Coremail) with SMTP id _____wDH7ou1495l4CPFFQ--.17527S2; Wed, 28 Feb 2024 15:41:41 +0800 (CST) From: songxiebing <soxiebing@163.com> To: tiwai@suse.com Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, songxiebing <songxiebing@kylinos.cn> Subject: [PATCH v1] ALSA: hda: optimize the probe codec process Date: Wed, 28 Feb 2024 15:41:38 +0800 Message-Id: <20240228074138.23679-1-soxiebing@163.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wDH7ou1495l4CPFFQ--.17527S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Wry3Jr4UAFW7Ar1UJrWxtFb_yoW8Kr1Up3 W3Cr1fG3yxtF4akFs7Gw43Ka4xWa4kXan8Jw4Yyw13Xwn3Kr1fXr9YyrW8AFW8Cr429r1Y vw4UK3WkX3s8CaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j0iifUUUUU= X-CM-SenderInfo: 5vr0xvpelqwqqrwthudrp/xtbB0BqSw2WXwG99aQAAsS X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792127732416512398 X-GMAIL-MSGID: 1792127732416512398 |
Series |
[v1] ALSA: hda: optimize the probe codec process
|
|
Commit Message
songxiebing
Feb. 28, 2024, 7:41 a.m. UTC
From: songxiebing <songxiebing@kylinos.cn> In azx_probe_codecs function,when bus->codec_mask is becomes to 0(no codecs), execute azx_init_chip, bus->codec_mask will be initialized to a value again, this causes snd_hda_codec_new function to run, the process is as follows: -->snd_hda_codec_new -->snd_hda_codec_device_init -->snd_hdac_device_init---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s ---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s ---snd_hdac_read_parm(...AC_PAR_SUBSYSTEM_ID) 2s ---snd_hdac_read_parm(...AC_PAR_REV_ID) 2s ---snd_hdac_read_parm(...AC_PAR_NODE_COUNT) 2s when no codecs, read communication is error, each command will be polled for 2 second,a total of 10s, it is easy to some problem. like this: 2 [ 14.833404][ 6] [ T164] hda 0006:00: Codec #0 probe error; disabling it... 3 [ 14.844178][ 6] [ T164] hda 0006:00: codec_mask = 0x1 4 [ 14.880532][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000 5 [ 15.891988][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000 6 [ 16.978090][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0001 7 [ 18.140895][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0002 8 [ 19.135516][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0004 10 [ 19.900086][ 6] [ T164] hda 0006:00: no codecs initialized 11 [ 45.573398][ 2] [ C2] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:0:25] Here, when bus->codec_mask is 0, use a direct break to avoid execute snd_hda_codec_new function. Signed-off-by: songxiebing <songxiebing@kylinos.cn> --- sound/pci/hda/hda_controller.c | 3 +++ 1 file changed, 3 insertions(+)
Comments
On Wed, 28 Feb 2024 08:41:38 +0100, songxiebing wrote: > > From: songxiebing <songxiebing@kylinos.cn> > > In azx_probe_codecs function,when bus->codec_mask is becomes to 0(no codecs), > execute azx_init_chip, bus->codec_mask will be initialized to a value again, > this causes snd_hda_codec_new function to run, the process is as follows: > -->snd_hda_codec_new > -->snd_hda_codec_device_init > -->snd_hdac_device_init---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s > ---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s > ---snd_hdac_read_parm(...AC_PAR_SUBSYSTEM_ID) 2s > ---snd_hdac_read_parm(...AC_PAR_REV_ID) 2s > ---snd_hdac_read_parm(...AC_PAR_NODE_COUNT) 2s > when no codecs, read communication is error, each command will be polled for > 2 second,a total of 10s, it is easy to some problem. > like this: > 2 [ 14.833404][ 6] [ T164] hda 0006:00: Codec #0 probe error; disabling it... > 3 [ 14.844178][ 6] [ T164] hda 0006:00: codec_mask = 0x1 > 4 [ 14.880532][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000 > 5 [ 15.891988][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000 > 6 [ 16.978090][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0001 > 7 [ 18.140895][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0002 > 8 [ 19.135516][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0004 > 10 [ 19.900086][ 6] [ T164] hda 0006:00: no codecs initialized > 11 [ 45.573398][ 2] [ C2] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:0:25] > > Here, when bus->codec_mask is 0, use a direct break to avoid execute snd_hda_codec_new function. > > Signed-off-by: songxiebing <songxiebing@kylinos.cn> Thanks for the patch. The code change looks OK, but you use both ASCII and non-ASCII comma letters in the patch description. Could you try to keep only ASCII letters? Takashi
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index e5c53ad..e1ece0a 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -1474,6 +1474,9 @@ int azx_probe_codecs(struct azx *chip, unsigned int max_slots) dev_warn(chip->card->dev, "Codec #%d probe error; disabling it...\n", c); bus->codec_mask &= ~(1 << c); + /* no codecs */ + if (bus->codec_mask == 0) + break; /* More badly, accessing to a non-existing * codec often screws up the controller chip, * and disturbs the further communications.