linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-sound@vger.kernel.org,
	Herve Codina <herve.codina@bootlin.com>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [RFC PATCH 3/3] ALSA: pcm: Convert snd_pcm_sync_ptr() to user_access_begin/user_access_end()
Date: Fri, 13 Jun 2025 14:37:14 +0200	[thread overview]
Message-ID: <87wm9frf5x.wl-tiwai@suse.de> (raw)
In-Reply-To: <2df61bbf-76f6-4932-a347-7820350a156e@csgroup.eu>

On Fri, 13 Jun 2025 13:03:04 +0200,
Christophe Leroy wrote:
> 
> 
> 
> Le 13/06/2025 à 11:29, Takashi Iwai a écrit :
> > On Thu, 12 Jun 2025 12:51:05 +0200,
> > Christophe Leroy wrote:
> >> 
> >> Now that snd_pcm_sync_ptr_get_user() and snd_pcm_sync_ptr_put_user()
> >> are converted to user_access_begin/user_access_end(),
> >> snd_pcm_sync_ptr_get_user() is more efficient than a raw get_user()
> >> followed by a copy_from_user(). And because copy_{to/from}_user() are
> >> generic functions focussed on transfer of big data blocks to/from user,
> >> snd_pcm_sync_ptr_put_user() is also more efficient for small amont of
> >> data.
> >> 
> >> So use snd_pcm_sync_ptr_get_user() and snd_pcm_sync_ptr_put_user() in
> >> snd_pcm_sync_ptr() too.
> >> 
> >> In order to have snd_pcm_mmap_status32 similar to snd_pcm_mmap_status,
> >> replace to tsamp_{sec/nsec} and audio_tstamp_{sec/nsec} by equivalent
> >> struct __snd_timespec.
> >> 
> >> snd_pcm_ioctl_sync_ptr_buggy() is left as it is because the conversion
> >> wouldn't be straigh-forward do to the workaround it provides.
> >> 
> >> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> > 
> > Through a quick glance, all patches look almost fine, but one favor to
> > ask: this patch contains the convert from s32/s32 pair to struct
> > __snd_timespec.  It should be factored out to a prerequisite patch
> > instead of burying in a big change.
> 
> Shall I understand you prefer this series over the more simple "ALSA:
> pcm: Convert snd_pcm_ioctl_sync_ptr_{compat/x32} to
> user_access_begin/user_access_end()" patch ?

Err, no, sorry for ambiguity.
I wanted to move the replacement of tstamp_sec/nsec with struct
__snd_timespec as a small preliminary patch from patch#3.
That is,
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3103,11 +3103,9 @@ struct snd_pcm_mmap_status32 {
 	snd_pcm_state_t state;
 	s32 pad1;
 	u32 hw_ptr;
-	s32 tstamp_sec;
-	s32 tstamp_nsec;
+	struct __snd_timespec tstamp;
 	snd_pcm_state_t suspended_state;
-	s32 audio_tstamp_sec;
-	s32 audio_tstamp_nsec;
+	struct __snd_timespec audio_tstamp;
 } __packed;
etc.  By factoring this out, it becomes clear that the timespec
compatibility is fully cared.

__snd_timespec may be defined in different ways on user-space, but in
the kernel code, it's a single definition of s32/s32 pair.  This needs
to be emphasized.


thanks,

Takashi


  reply	other threads:[~2025-06-13 12:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 10:51 [RFC PATCH 1/3] ALSA: pcm: refactor copy from/to user in SNDRV_PCM_IOCTL_SYNC_PTR Christophe Leroy
2025-06-12 10:51 ` [RFC PATCH 2/3] ALSA: pcm: Convert SNDRV_PCM_IOCTL_SYNC_PTR to user_access_begin/user_access_end() Christophe Leroy
2025-06-12 10:51 ` [RFC PATCH 3/3] ALSA: pcm: Convert snd_pcm_sync_ptr() " Christophe Leroy
2025-06-13  9:29   ` Takashi Iwai
2025-06-13 11:03     ` Christophe Leroy
2025-06-13 12:37       ` Takashi Iwai [this message]
2025-06-13 12:46         ` Christophe Leroy
2025-06-13 14:59           ` Takashi Iwai

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=87wm9frf5x.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=broonie@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=herve.codina@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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;
as well as URLs for NNTP newsgroup(s).