Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org,
	sound-open-firmware@alsa-project.org
Subject: Re: [PATCH 06/14] ASoC: SOF: add a power status IPC
Date: Mon, 23 Mar 2020 10:31:02 +0100	[thread overview]
Message-ID: <20200323093102.GB16757@ubuntu> (raw)
In-Reply-To: <20200320163948.GD3961@sirena.org.uk>

On Fri, Mar 20, 2020 at 04:39:48PM +0000, Mark Brown wrote:
> On Fri, Mar 20, 2020 at 04:07:27PM +0100, Guennadi Liakhovetski wrote:
> > On Fri, Mar 20, 2020 at 02:27:32PM +0100, Guennadi Liakhovetski wrote:
> 
> > > No, this isn't a completion - it's a counter. I've used atomic variables 
> > > before, I cannot remember seeing any difficulties with their correct use 
> > > described. Do you have a pointer?
> 
> > Actually I'd even say this isn't a problem. I think it's safe to say, you 
> > won't suspend and resume your audio interface more often than every 10 
> > seconds. That makes under 3200000 cycles per year. Even with 31 bits for a 
> > signed integer that makes more than 600 years. I think we're safe.
> 
> The problem is that atomics are just incredibly error prone - for
> example they're just a plain number, they're usually counting something
> which is not being locked so you have to be careful any time you do
> anything around them.  Their lack of structure makes them harder to
> reason about than most other locking primitives, often harder than it's
> worth.

Ok, understand, but do you see any problems with this specific use case? 
Thinking about possible replacements - it isn't a case for a ref-count, 
because it isn't a get-put scenario. We really just need to count a 
specific event - DSP reboots. It can be the case that this counter doesn't 
need to be atomic at all. When it is read, the DSP is guaranteed to be up 
and running - I think. So no race would be possible. I can try to think 
about this more carefully and maybe make it a normal unprotected counter. 
But I don't think it has to be protected even better than what these 
patches are doing.

Thanks
Guennadi

  reply	other threads:[~2020-03-23  9:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 14:44 [PATCH 00/14] ASoC: SOF DSP virtualisation Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 01/14] ASoC: add function parameters to enable forced path pruning Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 02/14] ASoC: SOF: extract firmware-related operation into a function Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 03/14] ASoC: SOF: VirtIO: make a function global Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 04/14] vhost: convert VHOST_VSOCK_SET_RUNNING to a generic ioctl Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 05/14] ASoC: SOF: support IPC with immediate response Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 06/14] ASoC: SOF: add a power status IPC Guennadi Liakhovetski
2020-03-13 14:39   ` Mark Brown
2020-03-20 11:52     ` Guennadi Liakhovetski
2020-03-20 12:19       ` Mark Brown
2020-03-20 13:27         ` Guennadi Liakhovetski
2020-03-20 15:07           ` Guennadi Liakhovetski
2020-03-20 16:39             ` Mark Brown
2020-03-23  9:31               ` Guennadi Liakhovetski [this message]
2020-03-23 12:37                 ` Mark Brown
2020-03-12 14:44 ` [PATCH 07/14] ASoC: SOF: add two helper lookup functions Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 08/14] ASoC: SOF: fix uninitialised "work" with VirtIO Guennadi Liakhovetski
2020-03-13 14:45   ` Mark Brown
2020-03-13 15:24   ` [Sound-open-firmware] " Sridharan, Ranjani
2020-03-12 14:44 ` [PATCH 09/14] ASoC: SOF: add a VirtIO DSP driver Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 10/14] ASoC: SOF: add a vhost driver: sound part Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 11/14] vhost: add an SOF DSP driver Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 12/14] ASoC: SOF: VirtIO: check guest component IDs Guennadi Liakhovetski
2020-03-13 18:39   ` Mark Brown
2020-03-12 14:44 ` [PATCH 13/14] ASoC: SOF: VirtIO: free guest pipelines upon termination Guennadi Liakhovetski
2020-03-12 14:44 ` [PATCH 14/14] ASoC: SOF: VirtIO: enable simultaneous playback and capture Guennadi Liakhovetski
2020-03-13 14:31 ` [PATCH 00/14] ASoC: SOF DSP virtualisation Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200323093102.GB16757@ubuntu \
    --to=guennadi.liakhovetski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox