[RFC PATCH 3/3] ALSA: pcm: Convert snd_pcm_sync_ptr() to user_access_begin/user_access_end()

Christophe Leroy christophe.leroy at csgroup.eu
Fri Jun 13 21:03:04 AEST 2025



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 at 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 ?

I'm asking because I was myself not sure about the benefit of such two 
big macros over the other proposal in terms of readability.


> 
> I'm asking it because this timepsec definition is very confusing (and
> complex) due to historical reasons, and it should be handled with a
> special care.
> IIUC, struct __snd_timespec is always s32/s32 for the kernel code, so
> the conversion must be fine.  This needs to be commented in the
> commit.


Sure I will do that.

Christophe


More information about the Linuxppc-dev mailing list