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 X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F0E9C432C0 for ; Fri, 22 Nov 2019 18:13:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3AFAB2067D for ; Fri, 22 Nov 2019 18:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726977AbfKVSN5 (ORCPT ); Fri, 22 Nov 2019 13:13:57 -0500 Received: from mx2.suse.de ([195.135.220.15]:55454 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726046AbfKVSN4 (ORCPT ); Fri, 22 Nov 2019 13:13:56 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 332B6ADCF; Fri, 22 Nov 2019 18:13:55 +0000 (UTC) Date: Fri, 22 Nov 2019 19:13:54 +0100 Message-ID: From: Takashi Iwai To: Andrew Gabbasov Cc: , , "Jaroslav Kysela" , Takashi Iwai , Timo Wischer Subject: Re: [PATCH 1/2] ALSA: aloop: Remove redundant locking in timer open function In-Reply-To: <20191122175218.17187-1-andrew_gabbasov@mentor.com> References: <20191122175218.17187-1-andrew_gabbasov@mentor.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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Nov 2019 18:52:17 +0100, Andrew Gabbasov wrote: > > loopback_parse_timer_id() uses snd_card_ref(), that can lock on mutex, > also snd_timer_instance_new() uses non-atomic allocation, that can sleep. > So, both functions can not be called from loopback_snd_timer_open() > with cable->lock spinlock locked. > > Moreover, most part of loopback_snd_timer_open() function body works > when the opposite stream of the same cable does not yet exist, and > the current stream is not yet completely open and can't be running, > so existing locking of loopback->cable_lock mutex is enough to protect > from conflicts with simultaneous opening or closing. > Locking of cable->lock spinlock is not needed in this case. > > Fixes: 26c53379f98d ("ALSA: aloop: Support selection of snd_timer instead of jiffies") > Signed-off-by: Andrew Gabbasov Applied, thanks. Takashi