Skip to contentSkip to conversation

PROBLEM: OSS mixer does not work with second card.

DISCUSSION Dariush Pietrzak 3 participants 6 messages Mar 28, 2002 – Apr 2, 2002

lore
Share & tools
lore
#0 lore raw

Hello,
I have no idea whom to send/ask this.

[1.]
mixer can be accessed only by /dev/mixer, /dev/mixer1 does not work.
[2.]
There are two sound cards, first accessible as /dev/dsp, second as /dev/dsp1. Mixer for first is /dev/mixer, for second should be /dev/mixer1.. but it doesen't work.

eyck@ghost:~$ aumix -d /dev/mixer1 -r100
aumix:  MIXER_WRITE
eyck@ghost:~$ aumix -d /dev/mixer1 -w100
aumix:  MIXER_WRITE
 At first i thought it's a problem with gus driver, which i've been told
created some problems... but then I switched cards.. now gus is /dev/dsp
and sb is /dev/dsp1. And now I can control my gus, but no longer can
control sb.
[3.] Keywords: sound mixer
[4.] Kernel version: 2.4.18-xfs
[7.] ...irrelevant, probably.
[X.] 
 Who is current SOUND maintainer? Maybe I should switch to ALSA and stop
 bugging ppl?

best regards,

Signature · 3 lines
Eyck, 
 I'm back! And I'm BAD!
...Obviously within certain sensible preset parameters
#1 lore raw

Questions about /proc/stat

I have some questions about the "page" and "swap" entries in /proc/stat. Here is the relevant code from 2.4.12 /usr/src/linux/fs/proc/proc_misc.c:

292 len += sprintf(page + len,
293 "page %u %u\n"
294 "swap %u %u\n"
295 "intr %u",
296 kstat.pgpgin >> 1,
297 kstat.pgpgout >> 1,
298 kstat.pswpin,
299 kstat.pswpout,
300 sum
301 );

1. Why are kstat.pgpgin and kstat.pgpgout shifted right / halved?

2. Are the "page" and "swap" numbers mutually exclusive? That is, if a page is brought in from swap and counted in kstat.pswpin, is it also counted in kstat.pgpgin? I found the places in the code where the counts are incremented, but I couldn't tell if the swapin routine calls the block driver or not.
--
M. Edward Borasky

[email protected]

Actually, for their size, elephants don't smell all that bad.

#2 lore raw

Re: Questions about /proc/stat

On Thu, 28 Mar 2002, M. Edward (Ed) Borasky wrote:

| I have some questions about the "page" and "swap" entries in /proc/stat.
| Here is the relevant code from 2.4.12
| /usr/src/linux/fs/proc/proc_misc.c:
|
|     292         len += sprintf(page + len,
|     293                 "page %u %u\n"
|     294                 "swap %u %u\n"
|     295                 "intr %u",
|     296                         kstat.pgpgin >> 1,
|     297                         kstat.pgpgout >> 1,
|     298                         kstat.pswpin,
|     299                         kstat.pswpout,
|     300                         sum
|     301         );

Of course the basic answer is something like
Try cscope
or
cd /usr/src/linux
grep -r "kstat.p" * | more

Using the latter one:

| 1. Why are kstat.pgpgin and kstat.pgpgout shifted right / halved?

I had wondered that also, so you made me look.

pgpgin and pgpgout are maintained (counted) in units of 512-byte blocks but displayed in /proc/stat in 1 KB (KiB :) blocks by shifting right by 1.

| 2. Are the "page" and "swap" numbers mutually exclusive? That is, if a
| page is brought in from swap and counted in kstat.pswpin, is it also
| counted in kstat.pgpgin? I found the places in the code where the counts
| are incremented, but I couldn't tell if the swapin routine calls the
| block driver or not.

No, "page" and "swap" counts are not mutually exclusive. Both paths call submit_bh().

For swap:

mm/page_io.c::rw_swap_page_base():

	/* reads or writes a swap page */
	kstat.pswpin++;
	kstat.pswpout++;
	calls brw_page();
		which calls submit_bh();

For all low-level block I/O:

drivers/block/ll_rw_blk.c::ll_rw_block():

	/* low-level access to block devices */
	calls submit_bh();

drivers/block/ll_rw_blk.c::submit_bh():

	count := is number of 512-byte blocks;
	kstat.pgpgout += count;
	kstat.pgpgin += count;
	calls generic_make_request();
Signature · 1 line
~Randy
#3 lore raw

Re: Questions about /proc/stat

Quoted 2 lines · Randy.Dunlap

Of course the basic answer is something like
Try cscope

I can't find this -- does it come with Red Hat??

Quoted 3 lines

or
cd /usr/src/linux
grep -r "kstat.p" * | more

This worked.

Quoted 10 lines

Using the latter one:

| 1. Why are kstat.pgpgin and kstat.pgpgout shifted right / halved?

I had wondered that also, so you made me look.

pgpgin and pgpgout are maintained (counted) in units of 512-byte blocks but displayed in /proc/stat in 1 KB (KiB :) blocks by shifting right by 1.

Yes ... that I managed to figure out. Seems strange that pgpgin/out are in units of kilobytes and pswpin/out are in units of pages, though. Just another little hole that needs plugging in the documentation.

Quoted 21 lines
| 2. Are the "page" and "swap" numbers mutually exclusive? That is, if a
| page is brought in from swap and counted in kstat.pswpin, is it also
| counted in kstat.pgpgin? I found the places in the code where the counts
| are incremented, but I couldn't tell if the swapin routine calls the
| block driver or not.

No, "page" and "swap" counts are not mutually exclusive. Both paths call submit_bh().

For swap:

mm/page_io.c::rw_swap_page_base():

	/* reads or writes a swap page */
	kstat.pswpin++;
	kstat.pswpout++;
	calls brw_page();
		which calls submit_bh();

For all low-level block I/O:

drivers/block/ll_rw_blk.c::ll_rw_block():

Quoted 8 lines
	/* low-level access to block devices */
	calls submit_bh();

drivers/block/ll_rw_blk.c::submit_bh():

	count := is number of 512-byte blocks;
	kstat.pgpgout += count;
	kstat.pgpgin += count;
	calls generic_make_request();

Ah ... so every page to/from swap is counted in pswpin/out (as a page) and again in pgpgin/out as half-kilobytes :-). Incidentally, I also followed the third fork in this road, the one which derives the "blocks" read and written per device that show up in /proc/stat. Those "blocks" turn out to be 512 bytes long.

All of this is quite useful, actually, because I'm trying to make sense of some high-frequency (every 15 seconds) samples of I/O data. Thanks!!

Signature · 9 lines
M. Edward Borasky
[email protected]

The COUGAR Project
http://www.borasky-research.com/Cougar.htm

How to Stop A Folksinger Cold # 4
"Tie me kangaroo down, sport..."
Tie your own kangaroo down -- and stop calling me "sport"!
#4 lore raw

Re: Questions about /proc/stat

On Mon, 1 Apr 2002, M. Edward (Ed) Borasky wrote:

| On Mon, 1 Apr 2002, Randy.Dunlap wrote:
|
| > Of course the basic answer is something like
| >   Try cscope
|
| I can't find this -- does it come with Red Hat??

it's at cscope.sf.net

| > or
| >   cd /usr/src/linux
| >   grep -r "kstat.p" * | more
|
| This worked.
|
| >
| > Using the latter one:
| >
| > | 1. Why are kstat.pgpgin and kstat.pgpgout shifted right / halved?
| >
| > I had wondered that also, so you made me look.
| >
| > pgpgin and pgpgout are maintained (counted) in units of 512-byte
| > blocks but displayed in /proc/stat in 1 KB (KiB :) blocks by shifting
| > right by 1.
|
| Yes ... that I managed to figure out. Seems strange that pgpgin/out are
| in units of kilobytes and pswpin/out are in units of pages, though. Just
| another little hole that needs plugging in the documentation.
|
| > | 2. Are the "page" and "swap" numbers mutually exclusive? That is, if a
| > | page is brought in from swap and counted in kstat.pswpin, is it also
| > | counted in kstat.pgpgin? I found the places in the code where the counts
| > | are incremented, but I couldn't tell if the swapin routine calls the
| > | block driver or not.
|
| > No, "page" and "swap" counts are not mutually exclusive.
| > Both paths call submit_bh().
| >
[snippage]
|
| Ah ... so every page to/from swap is counted in pswpin/out (as a page)
| and again in pgpgin/out as half-kilobytes :-). Incidentally, I also
| followed the third fork in this road, the one which derives the "blocks"
| read and written per device that show up in /proc/stat. Those "blocks"
| turn out to be 512 bytes long.

Do you mean this line or something else?
disk_io: (3,0):(616296,386142,7120356,230154,3010882)

| of some high-frequency (every 15 seconds) samples of I/O data. Thanks!!

Sure, no problem.

Signature · 1 line
~Randy
#5 lore raw

Re: Questions about /proc/stat

Quoted 10 lines · Randy.Dunlap

On Mon, 1 Apr 2002, M. Edward (Ed) Borasky wrote:

| On Mon, 1 Apr 2002, Randy.Dunlap wrote:
|
| > Of course the basic answer is something like
| >   Try cscope
|
| I can't find this -- does it come with Red Hat??

it's at cscope.sf.net

OK ... I'll go grab it.

Quoted 8 lines
| Ah ... so every page to/from swap is counted in pswpin/out (as a page)
| and again in pgpgin/out as half-kilobytes :-). Incidentally, I also
| followed the third fork in this road, the one which derives the "blocks"
| read and written per device that show up in /proc/stat. Those "blocks"
| turn out to be 512 bytes long.

Do you mean this line or something else?
disk_io: (3,0):(616296,386142,7120356,230154,3010882)

Yeah ... that one. I have code that samples that every 15 seconds, as well as everything else in /proc/stat. I was having trouble making sense of the I/O numbers.

Q. How do you tell when a pineapple is ready to eat? A. It picks up its knife and fork.