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 B1370EB64DC for ; Sun, 25 Jun 2023 18:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbjFYSNy (ORCPT ); Sun, 25 Jun 2023 14:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjFYSNw (ORCPT ); Sun, 25 Jun 2023 14:13:52 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5032B1BC for ; Sun, 25 Jun 2023 11:13:47 -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 D016421887; Sun, 25 Jun 2023 18:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1687716825; 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=mIGYuXeg3Z3crSQru1UTV8eTEHb5NndbE7Ik2w/PaYo=; b=b7RKU4pPTLR0INoyzyhMF9lIQspZNJJvm2twY/ICPsJDHzIsMZfM5VBCJ/BkOMTSEL8Ma7 p476GHGVc8bSASsSlqQX+lVPE1wQS34MJSZ4MGqoevVottAU/cpWFMdycgTpUfBcXwk0hR iwrv4h8JCLRxgqtI59sBM2W+y5+2iUA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1687716825; 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=mIGYuXeg3Z3crSQru1UTV8eTEHb5NndbE7Ik2w/PaYo=; b=kidsZl/NA/HZaCeRvnKNFz13WxMid2WGVay/w+59zHqmH4K2wxT0Nsbv5VgzM1kA40jxA+ A5j81ekjJIUtr8Bg== 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 95C4913462; Sun, 25 Jun 2023 18:13:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MW/nItmDmGQcFQAAMHmgww (envelope-from ); Sun, 25 Jun 2023 18:13:45 +0000 Date: Sun, 25 Jun 2023 20:13:45 +0200 Message-ID: <87edlzwgti.wl-tiwai@suse.de> From: Takashi Iwai To: YE Chengfeng Cc: "perex@perex.cz" , "tiwai@suse.com" , "yunjunlee@chromium.org" , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] ALSA: dummy: Fix &dpcm->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 17:35:48 +0200, YE Chengfeng wrote: > > The timer dummy_systimer_callback is executed under softirq > context, thus other process context code requiring the same lock > should disable interrupt. Otherwise there would be potential > deadlock issues when the code executing under process context > (i.e., dummy_systimer_pointer, dummy_systimer_start, > dummy_systimer_stop) is preempted by the timer while holding > the lock. > > Deadlock scenario: > dummy_systimer_pointer > -> spin_lock(&dpcm->lock); > > -> dummy_systimer_callback > -> spin_lock_irqsave(&dpcm->lock, flags); > > Fix the potential deadlock by using spin_lock_irqsave. Did you really trigger this deadlock, or is just your hypothesis? I'm asking it because basically the deadlock above shouldn't happen; those are called only via PCM trigger and pointer callbacks, and they are always called inside the PCM stream lock, and already irq-disabled. thanks, Takashi