Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp14794pxb; Tue, 2 Mar 2021 17:27:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXI0HJeLFO3tMpF5qZdPD9dl3nL9fSluXoaLnMzRm3OLZqtVFh+B/dpJ8gvHQnuVDrEK1V X-Received: by 2002:a05:6402:3550:: with SMTP id f16mr9412099edd.134.1614734877196; Tue, 02 Mar 2021 17:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614734877; cv=none; d=google.com; s=arc-20160816; b=vzx5ijUxWZ0oh8aivcVyTFG/OEnNyp2tANptO2S0ITXsaCJ/qsMzZO1sC/s1UB73wo ToFdeSENcCpgbiDegbuucBWW7ZoShWAyRzM6p5GEE3KMOkIBICSyR/kurN5wLIjQ84Vx c3TfmyFk1Xq2L0W7hQ/2I+/zXbMiWZoMdFCewlw7SC6hEJi7j6lLc1Q06NW+df8TI8sW dI6EI34DHWG5j7P+BJh6tMP7NbCP1Sg74y83rE6YP3exHDHnHEUVuLvIwyih+kIFwWnE se02DpRM1CuMltkgkwstJ2IOMu+PapzpAPlHIRwZ8CRxJomtiQ3tqv8YkXn6Ou4LOsE4 9MFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:date:message-id:from:references:cc:to :subject:dkim-signature; bh=AF2+aLbHpYk6yxg/KMusF89bfRVX3X9/VCCjZ8mooHU=; b=yb1wtd4Az5F00atrCGQ6R/hD7MsZ7DM3hY7oVdvXf4dIfFz/TbQokr3BJHEe9MyGWk 4wSH8zoA0nipG5CbvQAWSl8eyGOm2lAWBcYpxjNw13seekacqazQtnkV1kYgBE3PYKoS 5PfZloC5NpYn8inrivJkvadDHKOcyBuZZMhvKO1AMhEzMka5BHUGNqVt9+kAlCBy5DTp zjeKh3PVveUUibxHX4yXNg5N65MJ/Yc69DSrA3rztPLJ/+zDlFZpLCnSKJu7AL6Q1Znq HAsQP3PI6htNyzEbbWCKiYBkg5eJ9APOX2RvmPcuvg+ZEQ9gVXjhCxHPdwXGLYWJmK6y cHiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=srmailgate02 header.b=njrad0q9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=opensynergy.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l21si14393333edw.317.2021.03.02.17.27.34; Tue, 02 Mar 2021 17:27:57 -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; dkim=pass header.i=@opensynergy.com header.s=srmailgate02 header.b=njrad0q9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=opensynergy.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233944AbhCAJaU (ORCPT + 99 others); Mon, 1 Mar 2021 04:30:20 -0500 Received: from mx1.opensynergy.com ([217.66.60.4]:55665 "EHLO mx1.opensynergy.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233934AbhCAJaI (ORCPT ); Mon, 1 Mar 2021 04:30:08 -0500 Received: from SR-MAILGATE-02.opensynergy.com (localhost.localdomain [127.0.0.1]) by mx1.opensynergy.com (Proxmox) with ESMTP id 98005A1340; Mon, 1 Mar 2021 10:29:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opensynergy.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=srmailgate02; bh=AF2+aLbHpYk6 yxg/KMusF89bfRVX3X9/VCCjZ8mooHU=; b=njrad0q9gBYFdXuKLLKrdMQiJrmC 2BkUzmkCM+/7GTmtBRL4KEei2E9d4aTwbewItdx8ywzFTZ+Wq+o0YIf8ctZOxS6s pWUn/fd83sGZ/mCG1K5YR5fADtw4ahaRbEnXVRkPL6sL2RWJlDxJ4xow1k7GxPEl wsNo0I+0+kfO+5odG3fJVrIfyApV8XWZNWyz1D/U2mYX25e+aY8VQk5NmK18oKUf AXuAStUtmc5vLAuHdldToU4L4wQobXvwR0KNh3CO0PUQIgSbPn1tUFY+nQuOALEY zXBiH5ZcCoYx9U6bwN5/r1O8apbH0HBuDUG76grDuZ0I2zjZIrk1jMc/Zw== Subject: Re: [PATCH v6 6/9] ALSA: virtio: PCM substream operators To: Takashi Iwai CC: , , , "Michael S. Tsirkin" , Jaroslav Kysela , Takashi Iwai , References: <20210227085956.1700687-1-anton.yakovlev@opensynergy.com> <20210227085956.1700687-7-anton.yakovlev@opensynergy.com> From: Anton Yakovlev Message-ID: Date: Mon, 1 Mar 2021 10:29:24 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-01.open-synergy.com (10.26.10.21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > thanks, > > Takashi > -- Anton Yakovlev Senior Software Engineer OpenSynergy GmbH Rotherstr. 20, 10245 Berlin