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 5D95FC433EF for ; Tue, 28 Sep 2021 08:46:21 +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 755FC611C3 for ; Tue, 28 Sep 2021 08:46:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 755FC611C3 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 71C13169F; Tue, 28 Sep 2021 10:45:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 71C13169F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1632818778; bh=LT7ZXw5OARsWf8IaTUps5Ddg/zY5rROx7rQyttiZBqA=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rRkIC5FnNWJcr6c7/u22OzJXWg00j/r7rocogkPaE8om9bFUbBldDnjkR3yttj/oT 4xsaFfw+JKGOi+ZRdXdPQwgtaWrI/oQEhyy/dQM+BZCXSPuMnbd/q6DO+4KtbMrZdW rGv0eg/Vg7uJOiZxfRjye3hQP6ka3XDB2fVu3R0s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 08E1CF80161; Tue, 28 Sep 2021 10:45:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 49EB3F8032C; Tue, 28 Sep 2021 10:45:26 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 C8E1EF800DE for ; Tue, 28 Sep 2021 10:45:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C8E1EF800DE Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="GWfdqHGA"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="91lOfqHu" Received: from relay1.suse.de (relay1.suse.de [149.44.160.133]) by smtp-out2.suse.de (Postfix) with ESMTP id 064051FF95; Tue, 28 Sep 2021 08:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1632818723; 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=JFJwiJzx8wvKhHxFwrO3DEeo971dP6dRX07GIDnytjg=; b=GWfdqHGACWGreq9tEt65caTONQu8S5Ak3xSWFb6MmBuDhcyaINFXTq6p1DGe55ecf7jWCM UxtHd37ZQfAIb6Q1UEGuimOXpTrKktk+yGfvzVBMjFxCv0Nm8ARgPIrC78H2vH9Df83AOh CPZHqNC6bmZfrmV6+J73HdW/kkkNib8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1632818723; 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=JFJwiJzx8wvKhHxFwrO3DEeo971dP6dRX07GIDnytjg=; b=91lOfqHusPzRS64pK9WhdiqJIoak7pZuBgtWzzswKuhOBEfJ+Oln+hwey/B53wGw0IKeDx FoZrIesPikB4tOAg== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay1.suse.de (Postfix) with ESMTP id EBE9425D55; Tue, 28 Sep 2021 08:45:22 +0000 (UTC) Date: Tue, 28 Sep 2021 10:45:22 +0200 Message-ID: From: Takashi Iwai To: Pierre-Louis Bossart Subject: Re: [RFC PATCH 0/4] ALSA: hda: potential hdac_stream locking issues? In-Reply-To: <20210924192417.169243-1-pierre-louis.bossart@linux.intel.com> References: <20210924192417.169243-1-pierre-louis.bossart@linux.intel.com> 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: Cezary Rojewski , alsa-devel@alsa-project.org, broonie@kernel.org, vkoul@kernel.org 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 Fri, 24 Sep 2021 21:24:13 +0200, Pierre-Louis Bossart wrote: > > While reviewing the HDAudio DMA handling, I found a number of > inconsistencies in how spin_locks are used. It's not clear what the > HDaudio bus->reg_lock is supposed to protect. In most cases only the > writes to specific boolean status flags are protected, and there are > multiple cases of taking the lock after testing a status flag. > > This patchset suggests a more consistent locking pattern, but it's > entirely possible that the bus->reg_lock is only intented to protect > register read/write access on the HDaudio bus, and not the status > flags, and that this entire piece of code is completely > over-engineered. > > On the Intel side no one knows why this spinlock was used, the reasons > are lost to history. I set the 'RFC' status on purpose in the hope > that Takashi might recall what this lock is supposed to protect. The > diff format makes this patchset difficult to review, it's recommended > to apply the patches and look at entire functions with changes to get > a better idea of the suggested changes. Oh well, the missing piece was the lock inside the loop in *_stream_assign(). It was lost while factoring out and converting to the HD-audio core code. (The lock wasn't taken on the whole loop at that time because the list itself was supposed to be static.) In anyway, I applied all patches except for patch#2, as the fixes for spinlock look correct. thanks, Takashi