Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3249538pxb; Mon, 1 Mar 2021 05:36:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjv7pXJ/n6so8/aGQ9XhZavAPqdFvLxTJaf7y9i+VC9Q+Azh24whuV2u4B9pnRgy15XLcS X-Received: by 2002:a17:906:eb89:: with SMTP id mh9mr16317996ejb.122.1614605793203; Mon, 01 Mar 2021 05:36:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614605793; cv=none; d=google.com; s=arc-20160816; b=DAfzBEDB47vVWSK3JMB0iuOyaB+FroNLBKWo33S5snNl06HBZ8Ya75gnssiCNLo0dD xk4Y/H0aDGsMcMby97UfLiTMuSHfE+qU2NkDAyvYmyEOz0Bm4cFcS38lggBxuOI+7tly ddQASB86M+cXkw/mC2o0jftE6s3wwcD01UHUdCig4ogAgQR6dWaKPxkkSgMo/XBqBBmX F6qaOzLtWzrGyYk/Q+GnO/qWuYbr94MSrsarZq/OcbeuqIjGGwXXBhf5MuPJb8+IF6f9 vs41PwaHMkUJEC//YkkLwkFGdFr/Ra5J0KW+VOhsLcvQvm1bhAVHaGoVr2vQC/sJ8WXR P7QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=pFFwtBLAI/dhXFhahQh73HDOsBHeFma7y63kuS2nePs=; b=c2qG3jhyePOQpRzRP4IzQwnmFD9KD0M1g75cR5Y2szLBGw8MiBSwrmem/7ShZ63XW0 w9Ajzo0/vBz+FW12JLxbyItHWMqnERf8cbC3VLEPaW94dwY+sy9ll2yWN7k8jbwlKbD7 ErkHPTSkBDMKYtFxe1irYuGQSRpTct75IwWhJG/KhhfXOWhSn78h2DfKcmCMJbXt0tJ7 XhRuXNQDdwdglH/cMwdv52aIoRByaUe9T7Jf64f9WEY8pXDErOVip8nMyHcaPKOqCY48 5pSF1AlY5Cd6b/SXMnF2zvJZWhcapm1XOZWnligeUBOYqntaLYuq5d1p+lPJZGEYakhl sc1A== 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 jg5si10971444ejc.490.2021.03.01.05.36.09; Mon, 01 Mar 2021 05:36:33 -0800 (PST) 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 S235757AbhCANef (ORCPT + 99 others); Mon, 1 Mar 2021 08:34:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:39218 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235825AbhCANdu (ORCPT ); Mon, 1 Mar 2021 08:33:50 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2B7EEAB8C; Mon, 1 Mar 2021 13:33:09 +0000 (UTC) Date: Mon, 01 Mar 2021 14:33:09 +0100 Message-ID: From: Takashi Iwai To: Anton Yakovlev Cc: , , , "Michael S. Tsirkin" , Jaroslav Kysela , Takashi Iwai , Subject: Re: [PATCH v6 6/9] ALSA: virtio: PCM substream operators In-Reply-To: References: <20210227085956.1700687-1-anton.yakovlev@opensynergy.com> <20210227085956.1700687-7-anton.yakovlev@opensynergy.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 01 Mar 2021 10:29:24 +0100, Anton Yakovlev wrote: > > On 28.02.2021 12:32, Takashi Iwai wrote: > > On Sat, 27 Feb 2021 09:59:53 +0100, > > Anton Yakovlev wrote: > >> > > > [snip] > > > >> +static snd_pcm_uframes_t > >> +virtsnd_pcm_pointer(struct snd_pcm_substream *substream) > >> +{ > >> + struct virtio_pcm_substream *vss = snd_pcm_substream_chip(substream); > >> + snd_pcm_uframes_t hw_ptr = SNDRV_PCM_POS_XRUN; > >> + unsigned long flags; > >> + > >> + spin_lock_irqsave(&vss->lock, flags); > >> + if (!vss->xfer_xrun) > >> + hw_ptr = bytes_to_frames(substream->runtime, vss->hw_ptr); > >> + spin_unlock_irqrestore(&vss->lock, flags); > > > > Oh, and if we drop nonatomc PCM, both trigger and pointer callbacks > > are guaranteed to be called inside the spinlock, hence you can remove > > *_irqsave() but just us spin_lock() in those two callbacks. > > As I understand, spin_lock_irqsave() disables only local interrupts. But > what about other CPU cores? Those are already under spin_lock_irqsave() of the PCM substream lock (in the case of normal PCM operation without nonatomic flag). Takashi