Skip to contentSkip to conversation

Another Brute Force And Ignorance(tm) derived question...

DISCUSSION Peter Jones 3 participants 10 messages Apr 12, 1999

lore
Share & tools
lore
#0 lore raw

(Yeah, one of these days I'll actually learn something)

As I've said before, I'm attempting to get an es1371 going, and I'm running into a couple of things that are perplexing me... I've managed to get it to compile in (obvious config.in patch), and with some patches against es1371.c it doesn't even Oops anymore (these are getting merged in to the main kernel, I think... Thomas Sailer sent them off to Alan sometime last week), but I'm having some trouble after that, regarding how the ioctl()'s work on sparc64...

It looks as if the switch(cmd){...} in sys32_ioctl() goes through, and if it finds an ioctl() in its list, it runs it, and if not, it prints an error. But if I run, say, aumix, I get:

<4>sys32_ioctl: Unknown cmd fd(3) cmd(40044dfe) arg(0002563c)

I go to look what ioctl() it happened to send, and its doing

open("/dev/mixer", O_RDWR) = 4
ioctl(4, SOUND_MIXER_READ_DEVMASK, 0x2563c) = -1 EINVAL (Invalid argument)

Which doesn't make sense to me, because SOUND_MIXER_READ_DEVMASK is in its list, and is handled by es1371.c ...

Have I missed something obvious?

-- Peter

"If people are good only because they fear punishment, and hope for reward, then we are a sorry lot indeed."
-- Einstein

#1 lore raw

Date: Sun, 11 Apr 1999 20:08:46 -0400 (EDT)
From: Peter Jones <[email protected]>

<4>sys32_ioctl: Unknown cmd fd(3) cmd(40044dfe) arg(0002563c)

...

open("/dev/mixer", O_RDWR) = 4
ioctl(4, SOUND_MIXER_READ_DEVMASK, 0x2563c) = -1 EINVAL (Invalid argument)

...

Have I missed something obvious?

Might want to double-check on strace, have it print out the raw hex value for the ioctl cmd code and make sure it matches up.

Later,
David S. Miller
[email protected]

#2 lore raw
In reply to Peter Jones
Quoted 10 lines · David Miller
   Date: 	Sun, 11 Apr 1999 20:08:46 -0400 (EDT)
   From: Peter Jones <[email protected]>

   <4>sys32_ioctl: Unknown cmd fd(3) cmd(40044dfe) arg(0002563c)

...

open("/dev/mixer", O_RDWR) = 4
ioctl(4, SOUND_MIXER_READ_DEVMASK, 0x2563c) = -1 EINVAL (Invalid argument)

Quoted 6 lines

...

Have I missed something obvious?

Might want to double-check on strace, have it print out the raw hex value for the ioctl cmd code and make sure it matches up.

open("/dev/mixer", O_RDWR) = 4
ioctl(0x4, 0x40044dfe, 0x2563c) = -1 (errno 22)

No dice, matches up just fine. Any more ideas?

-- Peter

"I stick my neck out for nobody."
-- Bogart

#3 lore raw
In reply to Peter Jones

Date: Mon, 12 Apr 1999 00:04:05 -0400 (EDT)
From: Peter Jones <[email protected]>

Quoted 2 lines

Might want to double-check on strace, have it print out the raw hex value for the ioctl cmd code and make sure it matches up.

open("/dev/mixer", O_RDWR) = 4
ioctl(0x4, 0x40044dfe, 0x2563c) = -1 (errno 22)

No dice, matches up just fine. Any more ideas?

Could be a compiler bug then, put some debugging printk's into sys32_ioctl(), one right before the big switch which goes:

printk("sys32_ioctl(before switch): cmd(%08x) "

          "SOUND_MIXER_READ_DEVMASK(%08x)\n",
          cmd, SOUND_MIXER_READ_DEVMASK);

Then put a similar printk right below the case for SOUND_MIXER_READ_DEVMASK itself.

This bug would explain some problems I had with the gnome mixer applet and some other sound programs on sparc64...

Later,
David S. Miller
[email protected]

#4 lore raw
In reply to Peter Jones
Quoted 18 lines · David Miller

Date: Mon, 12 Apr 1999 00:04:05 -0400 (EDT)
From: Peter Jones <[email protected]>

Quoted 2 lines

Might want to double-check on strace, have it print out the raw hex value for the ioctl cmd code and make sure it matches up.

open("/dev/mixer", O_RDWR) = 4
ioctl(0x4, 0x40044dfe, 0x2563c) = -1 (errno 22)

No dice, matches up just fine. Any more ideas?

Could be a compiler bug then, put some debugging printk's into sys32_ioctl(), one right before the big switch which goes:

   printk("sys32_ioctl(before switch): cmd(%08x) "
          "SOUND_MIXER_READ_DEVMASK(%08x)\n",
          cmd, SOUND_MIXER_READ_DEVMASK);
Quoted 5 lines

Then put a similar printk right below the case for SOUND_MIXER_READ_DEVMASK itself.

This bug would explain some problems I had with the gnome mixer applet and some other sound programs on sparc64...

Hrm. Odd. When aumix calls that, its sending 0x20044dfe, which is what
kernelspace is _expecting_ to get. somewhere in the middle its becoming 0x40044dfe , which is falling through the case. Any ideas?

Anyway, I'm going to bed. I've managed to be in line for a 9:30 meating tomorrow.

-- Peter

Stay sane inside insanity.

		-- RHPS
#5 lore raw
In reply to Peter Jones

Date: Mon, 12 Apr 1999 00:50:47 -0400 (EDT)
From: Peter Jones <[email protected]>

Quoted 2 lines

This bug would explain some problems I had with the gnome mixer applet and some other sound programs on sparc64...

Hrm. Odd. When aumix calls that, its sending 0x20044dfe, which is what
kernelspace is _expecting_ to get. somewhere in the middle its becoming 0x40044dfe , which is falling through the case. Any ideas?

Maybe rebuild aumix with more recent kernel header files. I saw this too with xcdplay, so it might be the same problem.

Actually, I couldn't completely parse your recollection of the debugging printk output, can you show me exactly what the kernel said with your debugging statements? (even better yet, tell me the machine where you did this poking so I can go on and snoop around :-)

Later,
David S. Miller
[email protected]

#6 lore raw
In reply to Peter Jones
Quoted 27 lines · David Miller
Quoted 19 lines

Date: Mon, 12 Apr 1999 00:04:05 -0400 (EDT)
From: Peter Jones <[email protected]>

Quoted 2 lines

Might want to double-check on strace, have it print out the raw hex value for the ioctl cmd code and make sure it matches up.

open("/dev/mixer", O_RDWR) = 4
ioctl(0x4, 0x40044dfe, 0x2563c) = -1 (errno 22)

No dice, matches up just fine. Any more ideas?

Could be a compiler bug then, put some debugging printk's into sys32_ioctl(), one right before the big switch which goes:

   printk("sys32_ioctl(before switch): cmd(%08x) "
          "SOUND_MIXER_READ_DEVMASK(%08x)\n",
          cmd, SOUND_MIXER_READ_DEVMASK);
Quoted 5 lines

Then put a similar printk right below the case for SOUND_MIXER_READ_DEVMASK itself.

This bug would explain some problems I had with the gnome mixer applet and some other sound programs on sparc64...

Quoted 6 lines

Hrm. Odd. When aumix calls that, its sending 0x20044dfe, which is what
kernelspace is _expecting_ to get. somewhere in the middle its becoming 0x40044dfe , which is falling through the case. Any ideas?

Anyway, I'm going to bed. I've managed to be in line for a 9:30 meating tomorrow.

It must be some userland compilation problem. Make sure it passes ioctl(?, 0x20044dfe, ????????) to the kernel, then I don't see any translation beeing done on it. If I do such ioctl (don't have soundcard, but it should not matter), it does not print any kernel warning about undefined ioctl.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | [email protected] | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.2.5 on a sparc64 machine (3958.37 BogoMips)
___________________________________________________________________

#7 lore raw
In reply to Peter Jones
Quoted 10 lines · David Miller

Date: Mon, 12 Apr 1999 00:50:47 -0400 (EDT)
From: Peter Jones <[email protected]>

Quoted 2 lines

This bug would explain some problems I had with the gnome mixer applet and some other sound programs on sparc64...

Hrm. Odd. When aumix calls that, its sending 0x20044dfe, which is what
kernelspace is _expecting_ to get. somewhere in the middle its becoming 0x40044dfe , which is falling through the case. Any ideas?

Quoted 7 lines

Maybe rebuild aumix with more recent kernel header files. I saw this too with xcdplay, so it might be the same problem.

Actually, I couldn't completely parse your recollection of the debugging printk output, can you show me exactly what the kernel said with your debugging statements? (even better yet, tell me the machine where you did this poking so I can go on and snoop around :-)

When I add

printk("sys32_ioctl(before switch): cmd(%#010x) " "SOUND_MIXER_READ_DEVMASK(%#010x)\n",cmd,SOUND_MIXER_READ_DEVMASK);

before the switch, and the same surrounding the case in question, I get:

Apr 12 00:40:42 localhost kernel: sys32_ioctl(before switch):
cmd(0x80047482) SOUND_MIXER_READ_DEVMASK(0x20044dfe)
Apr 12 00:40:42 localhost kernel: sys32_ioctl(before case):
cmd(0x80047482) SOUND_MIXER_READ_DEVMASK(0x20044dfe)
Apr 12 00:40:42 localhost kernel: sys32_ioctl(after case): cmd(0x80047482)

SOUND_MIXER_READ_DEVMASK(0x20044dfe)

for most ioctl()'s, And when I actually try and use SOUND_MIXER_READ_DEVMASK I get:

Apr 12 00:40:42 localhost kernel: sys32_ioctl(before switch):
cmd(0x40044dfe) SOUND_MIXER_READ_DEVMASK(0x20044dfe)
Apr 12 00:40:42 localhost kernel: sys32_ioctl: Unknown cmd fd(3)

cmd(40044dfe) arg(0002563c)

Which seems strange to me in itself, because It doesn't look like its actually hitting that case. Unfortunatly, this is on a friend's box, not a box at work (being as I'm a tech support person, not a developer ;)

Also (maybe useful) if I go change aumix, so that its got:

printf("SOUND_MIXER_READ_DEVMASK(%#010x)\n",SOUND_MIXER_READ_DEVMASK);
if (ioctl(mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask))
return (3);

I get:

SOUND_MIXER_READ_DEVMASK(0x20044dfe)

out of aumix, and

Apr 12 08:36:30 localhost kernel: sys32_ioctl: Unknown cmd fd(4) 

cmd(40044dfe) arg(0002563c)

out of the kernel. (Unfortunatly, I already booted back to a kernel that didn't obscenely log on every ioctl() . I'll try that again later)

Its looking like if I do ioctl(mixer_fd,0x20044dfe,&devmask), it doesn't seem to do that, which is strange as well. I'll test this again once I rebuild that debug kernel later. *sigh*. Off too meetings now.

If I'm completely nuts, let me know. Hell, if you think you can talk them to letting me go buy one of these cards and stick it on one of the boxes in the testlab so you can look at this, let me know ;)

-- Peter

"Don't everyone thank me at once!"

		-- Solo
#8 lore raw
In reply to Peter Jones
Quoted 4 lines

When I add

printk("sys32_ioctl(before switch): cmd(%#010x) " "SOUND_MIXER_READ_DEVMASK(%#010x)\n",cmd,SOUND_MIXER_READ_DEVMASK);

I think you wrote in some other mail that strace prints out 0x40044dfe, thus it has really no value to look for bugs in the kernel.
Either gcc is broken, or you have some problems with includes, or whatever. Anyway, what distribution is it? UP, BlueSky or what?

On UP1.1.9, I get
open("/dev/mixer", O_RDWR) = 7
ioctl(7, 0x20044dfe, 0x25a20) = -1 ENOTTY (Inappropriate ioctl for device)
and no kernel errors from that ioctl (ENOTTY because my /dev/mixer is -> /dev/null, no soundcard here).

So, I'd suggest carefully looking at gcc -E output and step through it with gdb.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | [email protected] | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.2.5 on a sparc64 machine (3958.37 BogoMips)
___________________________________________________________________

#9 lore raw
In reply to Peter Jones
Quoted 7 lines · Jakub Jelinek
Quoted 4 lines

When I add

printk("sys32_ioctl(before switch): cmd(%#010x) " "SOUND_MIXER_READ_DEVMASK(%#010x)\n",cmd,SOUND_MIXER_READ_DEVMASK);

I think you wrote in some other mail that strace prints out 0x40044dfe, thus it has really no value to look for bugs in the kernel.

Right. Makes sense.

Quoted 2 lines

Either gcc is broken, or you have some problems with includes, or whatever. Anyway, what distribution is it? UP, BlueSky or what?

UP from mid-february. Might stick 5.9 on it sometime soon just to see. I think this is in includes somewhere. I'll check later.

Quoted 8 lines

On UP1.1.9, I get
open("/dev/mixer", O_RDWR) = 7
ioctl(7, 0x20044dfe, 0x25a20) = -1 ENOTTY (Inappropriate ioctl for device)
and no kernel errors from that ioctl (ENOTTY because my /dev/mixer is -> /dev/null, no soundcard here).

So, I'd suggest carefully looking at gcc -E output and step through it with gdb.

Will do. Thanks bunches for the help.

-- Peter

"I cannot believe that God plays dice with the cosmos."
-- Einstein