Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2769180imm; Wed, 3 Oct 2018 08:54:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV62SPaP4u9GT4jJq8rlxt4sd4vt+hLhymAmNGhZqfUVcBYIlB5RJO32uJK/BDSwuVLZy3y+V X-Received: by 2002:a63:6746:: with SMTP id b67-v6mr1961757pgc.310.1538582098939; Wed, 03 Oct 2018 08:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538582098; cv=none; d=google.com; s=arc-20160816; b=Sl19ergwSGeT2Eg8xODc25RBUIh4KZzjBXpLcIHdjMMYJYFssMNZKnWDIZSOh3nfGj MohUv2qgXc2Uu2ez5+W7ZBr5NBR/LDnEksP6xTwVpvOtd0IiKfRb9pLUI02Ihg7zaSTy UpPHAHzkjgvDQC1wpbGvDnEhjhcUygC6kUlkOYjb8Nm6Y0nqLeVmJYrGzEqRk4C8rIws 5rK2XilF/T4iHoJdb5+rQmBFGOOBoXzjLCka8ewm4faG0W8SiWvo+M07SwGfDvNplRpm Q7sW0CwKOUM2HZA5auqZ9OGnZz1WH9auG2Lk5ejc5lQPl35HarPxtW26qcUp8aHiA51s wwqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=/E+Oj+cOMJNUJlN8yPPxkv6bpBikzdAXZstx27HhnAM=; b=L467rX44dHYMwxEDdXxQdLxSUPD/t+8qhzXoYTFzV2cMP3sBihL6ogGxRk+oIiW3ww RXiNnvuuKe4ACyTIpttQE/9HBPjZa3SQl9oalomeUpSMyV6zY0NQYufjyuSNfn44Ycnz vu/3kj/yjBoaZxT2GBRL5wJFC5zbx4yBtQ0J7/XVAuTn9sjBleaJnRr83HLGRHnEdIbW J3Q4zhwOYYJsNIC6pV62e1WrJyj/bBxPwjzTliJv+rZbRXqiHAnAYph78IeP796DNKRb iEsJ4LQ3/GCqEqCO1zrsdjWEkprZKzG/89Xssi8qjWbICEalnQT+bhOmUv0811t17k45 FXEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d30-v6si1937490pla.200.2018.10.03.08.54.43; Wed, 03 Oct 2018 08:54:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727524AbeJCWnK (ORCPT + 99 others); Wed, 3 Oct 2018 18:43:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:57170 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726801AbeJCWnK (ORCPT ); Wed, 3 Oct 2018 18:43:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3A2CCAD4A; Wed, 3 Oct 2018 15:54:11 +0000 (UTC) Date: Wed, 03 Oct 2018 17:54:10 +0200 Message-ID: From: Takashi Iwai To: "Jia-Ju Bai" Cc: , , , "Linux Kernel Mailing List" Subject: Re: [BUG] sound: pci: trident: a possible data race In-Reply-To: <864e211c-8be5-6a34-902a-a71f176111db@gmail.com> References: <864e211c-8be5-6a34-902a-a71f176111db@gmail.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/26 (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 Wed, 03 Oct 2018 14:50:25 +0200, Jia-Ju Bai wrote: > > CPU0: > snd_trident_hw_free > snd_trident_free_voice > line 3870: spin_lock_irqsave() > line 3881: voice->substream = NULL; [WRITE] > CPU1: > snd_trident_interrupt > line 3798: snd_pcm_period_elapsed(voice->substream); [READ] > > As for voice->substream, the WRITE operation in CPU0 is performed > with holding a spinlock, but the READ operation in CPU1 is performed > without holding this spinlock, so there may exist a data race. Thanks for the report. The actual crash must be very unlikely, almost 0%, though. snd_trident_hw_free() is called always after the PCM stream gets stopped via trigger callback, i.e. at the moment, there is no corresponding interrupt is generated for that voice entry. And the hardware is very old, I bet only a handful people still using in the whole world :) If we really want to be 100% sure, we may call synchronize_irq() before the NULL-clearing. But there is no way to test the bug nor the fix, so it's fairly moot, IMO. thanks, Takashi