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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCDD9EB64DC for ; Sun, 25 Jun 2023 18:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229660AbjFYSO2 (ORCPT ); Sun, 25 Jun 2023 14:14:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjFYSO0 (ORCPT ); Sun, 25 Jun 2023 14:14:26 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C9C1B9 for ; Sun, 25 Jun 2023 11:14:25 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C0E3121887; Sun, 25 Jun 2023 18:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1687716863; 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=IobH/r92kTGjvuGu4EK7R8QGIkmpjSClxSPjpJ3vAGg=; b=eoIY6+Mz4ul52M+8iP1nUBmYJG6b9Ak0rsSAuYoK17jJDlJ+SNHTV+ju6fWU/OA63aDRYf Zeav8NhPa5heF7NS3+f2EVyb8e8Mo7pR2pPWMa4fzVh+ARJ+EpH8ARPMcp/QBXVz5KHA74 yJAng0KAFQL8ZDRsHYfMnCBKdYlkcYw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1687716863; 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=IobH/r92kTGjvuGu4EK7R8QGIkmpjSClxSPjpJ3vAGg=; b=v+qMZkn9W7rHhZh2mL5Lv/8Q7wp3YT+/kSgE0qYMVKF6X8X4c293uMa7AiN7B6WFFY/7ic BtBZ46kl3Ec+U6Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5B3DB13462; Sun, 25 Jun 2023 18:14:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id K6Y+Ff+DmGQ5FQAAMHmgww (envelope-from ); Sun, 25 Jun 2023 18:14:23 +0000 Date: Sun, 25 Jun 2023 20:14:22 +0200 Message-ID: <87cz1jwgsh.wl-tiwai@suse.de> From: Takashi Iwai To: YE Chengfeng Cc: "perex@perex.cz" , "tiwai@suse.com" , "pteerapong@chromium.org" , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] ALSA: aloop: Fix &cable->lock deadlock issues In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 25 Jun 2023 18:22:56 +0200, YE Chengfeng wrote: > > The timer loopback_jiffies_timer_function is executed under > bottom-half softirq context and require a spinlock, thus > other process context code requiring the same lock (i.e., > loopback_trigger, loopback_pointer) can deadlock with the > timer if it is preempted while holding the lock. > > Deadlock scenario: > loopback_trigger > -> spin_lock(&cable->lock); > > -> loopback_jiffies_timer_function > -> spin_lock_irqsave(&dpcm->cable->lock, flags); > > Fix the potential deadlock by using spin_lock_irqsave. Similarly like the patch for snd-dummy, this change looks superfluous, too. thanks, Takashi