Skip to contentSkip to conversation

ALSA: document that struct __snd_pcm_mmap_control64 is messed up

PATCH Superseded Oswald Buddenhagen 2 participants 8 messages Apr 5, 2023 – Apr 6, 2023 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: document that struct __snd_pcm_mmap_control64 is messed up

I suppose this can't be changed anymore due to binary compat concerns.

---
 include/uapi/sound/asound.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/sound/asound.h +1 -1
index de6810e94abe..595a683968bc 100644
@@ -570,7 +570,7 @@ struct __snd_pcm_mmap_status64 {
 struct __snd_pcm_mmap_control64 {
 	__pad_before_uframe __pad1;
 	snd_pcm_uframes_t appl_ptr;	 /* RW: appl ptr (0...boundary-1) */
-	__pad_before_uframe __pad2;
+	__pad_before_uframe __pad2;	 // BUG: this should have been __pad_after_uframe!
 
 	__pad_before_uframe __pad3;
 	snd_pcm_uframes_t  avail_min;	 /* RW: min available frames for wakeup */
Signature · 1 line
2.40.0.152.g15d061e6df
#1 lore raw
Quoted 2 lines · Oswald Buddenhagen

I suppose this can't be changed anymore due to binary compat concerns.

Yes, please check the thread at
https://lore.kernel.org/all/[email protected]/

Quoted 10 lines
---
 include/uapi/sound/asound.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/sound/asound.h +0 -0
index de6810e94abe..595a683968bc 100644

include/uapi/sound/asound.h struct __snd_pcm_mmap_status64 { · line 573

Quoted 5 lines
include/uapi/sound/asound.h +1 -1
@@ -570,7 +570,7 @@ struct __snd_pcm_mmap_status64 {
 struct __snd_pcm_mmap_control64 {
 	__pad_before_uframe __pad1;
 	snd_pcm_uframes_t appl_ptr;	 /* RW: appl ptr (0...boundary-1) */
-	__pad_before_uframe __pad2;
+	__pad_before_uframe __pad2;	 // BUG: this should have been __pad_after_uframe!

Writing this alone doesn't help much. Actual help would be to mention that this typo is kept intentionally.

Takashi

#2 lore raw
Quoted 5 lines · Takashi Iwai
Quoted 2 lines · Oswald Buddenhagen

I suppose this can't be changed anymore due to binary compat concerns.

Quoted 8 lines

Yes, please check the thread at
https://lore.kernel.org/all/[email protected]/

include/uapi/sound/asound.h struct __snd_pcm_mmap_status64 { · line 573

Quoted 1 line
include/uapi/sound/asound.h +1 -0
+	__pad_before_uframe __pad2;	 // BUG: this should have been __pad_after_uframe!

Writing this alone doesn't help much. Actual help would be to mention that this typo is kept intentionally.

hmm, my thinking is that the immediate response to reading that comment would be "so why don't you change it?!", at which point the person would either realize by themselves that this is subject to binary compat constraints, or would git-blame it and see the explanation.

anyway, my concern is keeping this *short*, so it doesn't distract.

maybe

// BUG: should be __pad_after_uframe, but binary compat

would do, though obviously the grammar kinda sucks.

the (too) long version could be

// BUG: this should be __pad_after_uframe, but // binary compatibility constraints prevent a fix.

choose your death, i'll deliver it. ;-)

#3 lore raw
Quoted 27 lines · Oswald Buddenhagen
Quoted 5 lines · Takashi Iwai
Quoted 2 lines · Oswald Buddenhagen

I suppose this can't be changed anymore due to binary compat concerns.

Quoted 8 lines

Yes, please check the thread at
https://lore.kernel.org/all/[email protected]/

include/uapi/sound/asound.h struct __snd_pcm_mmap_status64 { · line 573

Quoted 1 line
include/uapi/sound/asound.h +1 -0
+	__pad_before_uframe __pad2;	 // BUG: this should have been __pad_after_uframe!

Writing this alone doesn't help much. Actual help would be to mention that this typo is kept intentionally.

hmm, my thinking is that the immediate response to reading that comment would be "so why don't you change it?!", at which point the person would either realize by themselves that this is subject to binary compat constraints, or would git-blame it and see the explanation.

anyway, my concern is keeping this *short*, so it doesn't distract.

maybe

// BUG: should be __pad_after_uframe, but binary compat

Quoted 8 lines

would do, though obviously the grammar kinda sucks.

the (too) long version could be

// BUG: this should be __pad_after_uframe, but // binary compatibility constraints prevent a fix.

choose your death, i'll deliver it. ;-)

The "BUG:" suffix should be dropped. This would catch eyes of (badly) trained kernel programmers as if it were a kernel panic message :)

Also the term "binary compatibility" is ambiguous in this context -- especially because we're dealing with the code that treats the 32/64bit binary compatibility.

But, yeah, I'm for that direction.

thanks,

Takashi

#4 lore raw

PATCH v2 1/1 ALSA: document that struct __snd_pcm_mmap_control64 is messed up

Quoted 3 lines · Takashi Iwai

The "BUG:" suffix should be dropped. This would catch eyes of (badly) trained kernel programmers as if it were a kernel panic message :)

done

Quoted 4 lines

Also the term "binary compatibility" is ambiguous in this context -- especially because we're dealing with the code that treats the 32/64bit binary compatibility.

i wasn't sure what to make of that. how about this:

-- >8 --

I'm not the first one to run into this, see e.g.
https://lore.kernel.org/all/[email protected]/

---
 include/uapi/sound/asound.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/sound/asound.h +2 -1
index de6810e94abe..7eecc99ddef7 100644
@@ -570,7 +570,8 @@ struct __snd_pcm_mmap_status64 {
 struct __snd_pcm_mmap_control64 {
 	__pad_before_uframe __pad1;
 	snd_pcm_uframes_t appl_ptr;	 /* RW: appl ptr (0...boundary-1) */
-	__pad_before_uframe __pad2;
+	__pad_before_uframe __pad2;	 // This should be __pad_after_uframe, but binary
+					 // backwards compatibility constraints prevent a fix.
 
 	__pad_before_uframe __pad3;
 	snd_pcm_uframes_t  avail_min;	 /* RW: min available frames for wakeup */
Signature · 1 line
2.40.0.152.g15d061e6df
#5 lore raw
Quoted 28 lines · Oswald Buddenhagen
Quoted 3 lines · Takashi Iwai

The "BUG:" suffix should be dropped. This would catch eyes of (badly) trained kernel programmers as if it were a kernel panic message :)

done

Quoted 4 lines

Also the term "binary compatibility" is ambiguous in this context -- especially because we're dealing with the code that treats the 32/64bit binary compatibility.

i wasn't sure what to make of that. how about this:

-- >8 --

I'm not the first one to run into this, see e.g.
https://lore.kernel.org/all/[email protected]/

---
 include/uapi/sound/asound.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/sound/asound.h +0 -0
index de6810e94abe..7eecc99ddef7 100644

include/uapi/sound/asound.h struct __snd_pcm_mmap_status64 { · line 574

Quoted 6 lines
include/uapi/sound/asound.h +2 -1
@@ -570,7 +570,8 @@ struct __snd_pcm_mmap_status64 {
 struct __snd_pcm_mmap_control64 {
 	__pad_before_uframe __pad1;
 	snd_pcm_uframes_t appl_ptr;	 /* RW: appl ptr (0...boundary-1) */
-	__pad_before_uframe __pad2;
+	__pad_before_uframe __pad2;	 // This should be __pad_after_uframe, but binary
+					 // backwards compatibility constraints prevent a fix.

Looks much better.
Care to resubmit v2 patch?

Thanks!

Takashi

#6 lore raw
Quoted 2 lines · Takashi Iwai

Care to resubmit v2 patch?

that *was* a v2 patch - you can git-am the mail with --scissors (at least if i got it right). not acceptable?

#7 lore raw
Quoted 6 lines · Oswald Buddenhagen
Quoted 2 lines · Takashi Iwai

Care to resubmit v2 patch?

that *was* a v2 patch - you can git-am the mail with --scissors (at least if i got it right). not acceptable?

Please resubmit properly. Nowadays commits have the link to the mail of the patch submission, and such mixup makes it harder to follow.

Takashi