Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp730683imm; Thu, 4 Oct 2018 02:19:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV62ioUUY+8XkI4IoTsW5dfyfjnX+szStkSA6lv1g0exABFqM1iePm1n8DuAPsX7qtZdaYtth X-Received: by 2002:a17:902:5a45:: with SMTP id f5-v6mr5794490plm.26.1538644781442; Thu, 04 Oct 2018 02:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538644781; cv=none; d=google.com; s=arc-20160816; b=sXgcrmWUGd+uyRV+00qt+gTRiB6qoY4hDfEhfH+72SLIn2HEbpoKaIZ4/RtCzIxvGy W89vZK20SPAR68pbBPb8nHYFgUIFL/LqmsFTPYOfiX1qTl1uDBRaL0WB3dn1QHshggoz tl8vDoSHzj+/Bkg48ftMYY5xOX68Qqy17tg3l8G26776EiBXE4KpWOctKpkmVLYxGJc3 gUiF5e6HzQc4Rju4wymbo06G/7YavfO8Vy396RAaXoL7Z+Bx/OPd/dqb5ZPIsrBqhhyU /Vy+FvIWlkQtVCmTHGN4sFa4nFeRfXoEN4SKPq9BHSgwXCcEzVYsQwb0Sjf0qtxOwCPt jzow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=bmhM7/u2L/Z64GZwk50hxpk7YMbmNX1GUQUryl21ihY=; b=zErJv0Rx6riYpNZ+3HsdvDlUJ96EJ9xAbUcZKBvF9Nns9D03UMER/nsF2b9HcIqk/h KJmu7kYXffvob4E1OrFJY01sM4DOfiOHIY0pPIM5J805xWl7uc1kWurNOXfbctax2aLG n6CnunNkFfrnA1/AUp6tXTaoliu19lranYErA5JGxBWLZQL7PJRZ2OP8G3r0ITHUxpLF 3qNwwiHd9TbVc+c1uFzA4oSbCue9hFJJEhpN01qT+KhWHW+/4NT0GtR/jU+9k+56QGkR 9G0No7d9KDQ347EEfOg1qM32CsfBSQ6utme/iBX7qWY1xcN1rKcFOSaTsrHKSWLFQMoO aZPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KLpGOg7n; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69-v6si5039540plc.388.2018.10.04.02.18.56; Thu, 04 Oct 2018 02:19:41 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KLpGOg7n; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727661AbeJDQKT (ORCPT + 99 others); Thu, 4 Oct 2018 12:10:19 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:37774 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727030AbeJDQKT (ORCPT ); Thu, 4 Oct 2018 12:10:19 -0400 Received: by mail-pl1-f194.google.com with SMTP id az3-v6so4873446plb.4 for ; Thu, 04 Oct 2018 02:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=bmhM7/u2L/Z64GZwk50hxpk7YMbmNX1GUQUryl21ihY=; b=KLpGOg7nV/XYLqTFOSMop+iIiv2Jy3h3hJWN5407rcMPcN4bROtt6XRew7CwL9yRJA HbZJZ0jJx7Nlzz7X175NYhrW5Jjx1oyF9dF299givCRYjx8kaxFlENUD1CN55zcoXGHi 2WPQK1YANmadWHPlRQq4IyRUocVbBXy74NLEoZnRENpmdN7W2LOYbb6bTuQ+eXObijmz l3tUEos85LoOajxEJCGTr4kLJ8D7yRkAD+QkNMrOFBvySCx0UWMtH+pGzFAbpWBdB9pG N0e/QNmJb7e4gr68oGuhwEE+61HtfR8gPkAqCn8ZF2eXSW2bcyj49ZxfTfY7gdN6P+3A 2mhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=bmhM7/u2L/Z64GZwk50hxpk7YMbmNX1GUQUryl21ihY=; b=UR2syjXOzwBQ1maBcVGMKhyLyBLdXeTHslTpluNGK8VoRoFOnaZ21CkjLak5++lVNU rHkoUUmLfg3d+ctG/BMI5hcv+pLsDvhfl+mcr8E2A5YlO/4LDMpQB8ec/SL8h9dkefZ2 Q5lHHJu9QOXrMzOEJ1dKg/NA0+PRuZzLZUdhxkQdMie6aJKBokm/HwMjX7khztMAOHa5 EpPHIvSFyG0Pd6YRMle2OhR3s/VMbOpXyWFs5c1SNff3xTBRP8AFK0bzfDNKJ2Z1K7AD TYRRFCbv8wfjBQDsGkxTLSGPMDnW3VO1z8xx6ca2gHtMHaa5wRrJReTAwW76jRBzy/4I MgWg== X-Gm-Message-State: ABuFfogCBztKRQ7EMt8xKEVBWjCpby7BXapkPnmjz4LeoRtevUG1XhV2 +mn1/kOARwr+tzbJfuj2Em/NCq8b X-Received: by 2002:a17:902:7e0f:: with SMTP id b15-v6mr5659147plm.246.1538644678122; Thu, 04 Oct 2018 02:17:58 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.71.3? ([2402:f000:1:1501:200:5efe:a66f:4703]) by smtp.gmail.com with ESMTPSA id 68-v6sm9598694pfg.136.2018.10.04.02.17.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 02:17:57 -0700 (PDT) Subject: Re: [BUG] sound: pci: trident: a possible data race To: Takashi Iwai Cc: keescook@chromium.org, perex@perex.cz, alsa-devel@alsa-project.org, Linux Kernel Mailing List References: <864e211c-8be5-6a34-902a-a71f176111db@gmail.com> From: Jia-Ju Bai Message-ID: <3be565e2-d2fe-689b-52a9-f6bed0e215f1@gmail.com> Date: Thu, 4 Oct 2018 17:17:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/4 13:24, Takashi Iwai wrote: > On Thu, 04 Oct 2018 05:08:45 +0200, > Jia-Ju Bai wrote: >> Thanks for the reply :) >> >> >> On 2018/10/3 23:54, Takashi Iwai wrote: >>> 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. >> How about the case that playback and capture are performed concurrently? >> Namely, snd_trident_hw_free() is called for playback, and the >> interrupt is generated for capture. > They are different substreams, hence it won't pick up the substream > object. Actually, I performed a runtime testing, and found that snd_trident_hw_free() and snd_trident_interrupt() are executed concurrently. However, I did not check the substream object, so I guess this report was produced in the case that I mentioned. Anyway, my report should be false, sorry... Best wishes, Jia-Ju Bai