Re: [PATCH v4 2/3] ALSA: compress_offload: Add SNDRV_COMPRESS_TSTAMP64 ioctl

On 18-08-25, 15:05, Charles Keepax wrote:
On Tue, Aug 05, 2025 at 07:59:42AM +0200, Takashi Iwai wrote:
On Tue, 05 Aug 2025 06:47:59 +0200, Vinod Koul wrote:
On 01-08-25, 10:27, Joris Verhaegen wrote:
ret = snd_compr_update_tstamp(stream, &tstamp64); if (ret == 0) {
snd_compr_tstamp32_from_64(&tstamp32, &tstamp64);
ret = copy_to_user((struct snd_compr_tstamp __user *)arg,
&tstamp32, sizeof(tstamp32)) ?
if (is_32bit) {
snd_compr_tstamp32_from_64(&tstamp32, &tstamp64);
copy_from = &tstamp32;
copy_size = sizeof(tstamp32);
}
Most of the applications and people would be 32bit right now and we expect this to progressively change, but then this imposes a penalty as default path is 64 bit, since we expect this ioctl to be called very frequently, should we do this optimization for 64bit here?
Through a quick glance over the patch, I don't think you'll hit the significant performance loss. It's merely a few bytes of extra copies before copy_to_user(), after all. But, of course, it'd be more convincing if anyone can test and give the actual numbers.
That would be better
I am inclined to agree the impact should be very minimal and the only alternative is a more complex implementation. I would vote for leaving this as is.
But yes, we can for now, go ahead. It is internal kernel flow can be adapted anytime :-)

On Tue, 19 Aug 2025 07:08:08 +0200, Vinod Koul wrote:
On 18-08-25, 15:05, Charles Keepax wrote:
On Tue, Aug 05, 2025 at 07:59:42AM +0200, Takashi Iwai wrote:
On Tue, 05 Aug 2025 06:47:59 +0200, Vinod Koul wrote:
On 01-08-25, 10:27, Joris Verhaegen wrote:
ret = snd_compr_update_tstamp(stream, &tstamp64); if (ret == 0) {
snd_compr_tstamp32_from_64(&tstamp32, &tstamp64);
ret = copy_to_user((struct snd_compr_tstamp __user *)arg,
&tstamp32, sizeof(tstamp32)) ?
if (is_32bit) {
snd_compr_tstamp32_from_64(&tstamp32, &tstamp64);
copy_from = &tstamp32;
copy_size = sizeof(tstamp32);
}
Most of the applications and people would be 32bit right now and we expect this to progressively change, but then this imposes a penalty as default path is 64 bit, since we expect this ioctl to be called very frequently, should we do this optimization for 64bit here?
Through a quick glance over the patch, I don't think you'll hit the significant performance loss. It's merely a few bytes of extra copies before copy_to_user(), after all. But, of course, it'd be more convincing if anyone can test and give the actual numbers.
That would be better
I am inclined to agree the impact should be very minimal and the only alternative is a more complex implementation. I would vote for leaving this as is.
But yes, we can for now, go ahead. It is internal kernel flow can be adapted anytime :-)
OK, Joris, could you submit v5 with correction of what Vinod suggested in reviews?
thanks,
Takashi
participants (2)
-
Takashi Iwai
-
Vinod Koul