Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4362227ybg; Mon, 8 Jun 2020 06:07:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOF7mTJHSVzkaShFnsyEf5JBAQofVisBkeiObiqQNzfGkrtknHF2BkYRwUl/JJRerVAI/L X-Received: by 2002:aa7:cb53:: with SMTP id w19mr21016844edt.328.1591621620145; Mon, 08 Jun 2020 06:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591621620; cv=none; d=google.com; s=arc-20160816; b=J0QWn5UfEVaYAwL+RX3NRQsJbnElVB10Iwa3U0nWvYz/4JXJvmdxxJSHuUFcIyn8ek zQFEnLJFfgCZ0IGRsye6MF9jBVkVYbSPl5uJ+vDtvbEKqKJr5Ck7Vy7sEhcYj+i/dpeN GII9yT3N18q8sC/rJsszB8ceCpf3nZFFokakxNlqqAUPbx2xUDIo9b7+Pef2yggFZTPf leryikO5sen92HLOlf2tGx4t1piGpFE0jIHIo00AVBS8Fbopuyj0S+uwsvMTM/xaSYwL 119yAlVzIZaoa53BqDG4AwUvc9k3oWnhzs6SoQ4L9AZm9yGYH5DI3xjXFdMIBQzphHNg WZOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date; bh=KMNv+kD5Ei9l/k1UcxTvRxFjy2J02ublgTWFmZsQRZY=; b=oz/Ixdczi3e20aIkEENJHMgN/B29snYmHk/61WaJ/OES7hruwIcTaDCDovw4nu4JJo 4DcZN/rwGlEOQurDSkJcb1eiKIllJ1yrWSyWDficYf32pHoi6wgz8LpBj4iAfPZ75FYd LTGnARmPU8ODrWNkHg++0u0pASZBgzbOY6Waohr6nPvNvs93F259ZStDQYL+9YnpoBKx /ERF5APwq7Km0whUJ5GhbGg+6jNcAjyMwn0g82/+9Ihdd41P+3sK5UF3eejXIFXKRkJ2 hVx9ZvHeeSWrs671SGhsAs88SFVAGEnWHHp0GbYjeCzbr0W3ZC7ImOkZ30Jf3Tui6Wgf pPbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si7765788ejn.479.2020.06.08.06.06.33; Mon, 08 Jun 2020 06:07:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729175AbgFHNCM (ORCPT + 99 others); Mon, 8 Jun 2020 09:02:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:59490 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbgFHNCM (ORCPT ); Mon, 8 Jun 2020 09:02:12 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B0275AE8C; Mon, 8 Jun 2020 13:02:14 +0000 (UTC) Date: Mon, 08 Jun 2020 15:02:10 +0200 Message-ID: From: Takashi Iwai To: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] ALSA: pcm: fix snd_pcm_link() lockdep splat In-Reply-To: <37252c65941e58473b1219ca9fab03d48f47e3e3.1591610330.git.mirq-linux@rere.qmqm.pl> References: <37252c65941e58473b1219ca9fab03d48f47e3e3.1591610330.git.mirq-linux@rere.qmqm.pl> 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=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 08 Jun 2020 12:06:32 +0200, Michał Mirosław wrote: > > Add and use snd_pcm_stream_lock_nested() in snd_pcm_link/unlink > implementation. The code is fine, but generates a lockdep complaint: > > ============================================ > WARNING: possible recursive locking detected > 5.7.1mq+ #381 Tainted: G O > -------------------------------------------- > pulseaudio/4180 is trying to acquire lock: > ffff888402d6f508 (&group->lock){-...}-{2:2}, at: snd_pcm_common_ioctl+0xda8/0xee0 [snd_pcm] > > but task is already holding lock: > ffff8883f7a8cf18 (&group->lock){-...}-{2:2}, at: snd_pcm_common_ioctl+0xe4e/0xee0 [snd_pcm] > > other info that might help us debug this: > Possible unsafe locking scenario: > > CPU0 > ---- > lock(&group->lock); > lock(&group->lock); > > *** DEADLOCK *** > > May be due to missing lock nesting notation > > 2 locks held by pulseaudio/4180: > #0: ffffffffa1a05190 (snd_pcm_link_rwsem){++++}-{3:3}, at: snd_pcm_common_ioctl+0xca0/0xee0 [snd_pcm] > #1: ffff8883f7a8cf18 (&group->lock){-...}-{2:2}, at: snd_pcm_common_ioctl+0xe4e/0xee0 [snd_pcm] > [...] > > Cc: stable@vger.kernel.org > Fixes: f57f3df03a8e ("ALSA: pcm: More fine-grained PCM link locking") > Signed-off-by: Michał Mirosław Applied now. Thanks. Takashi