pnp bug in 2.6.27-rc1 (ad1816a / mpu401 / parport_pc issue)
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Uwe Bugla
1. 2626debian.txt is the dmesg of the latest 2.6.26.1 shipped with Debian Sid. It's no self-compiled kernel and it spurks out the following message:
[ 39.958560] MPU-401 device not found or device busy.This one is confusing because
Quoted 7 lines
a. the device is there and it is assumed to work - it is shown to be existent in KDE 4.1 info center, but not in the system info (perhaps phonon does not know yet what an ISA sound card is?)
b. it cannot be busy during startup - it can only be busy if some MIDI file is being played to some piano or some piano performs some input into a sequencer software or notation program.
That's why I would call that message simply dumb......
I agree; that message is confusing. It's from the "mpu401" driver in sound/drivers/mpu401/mpu401.c. Based on the driver source, it just means we didn't find an MPU-401 device for some reason. It could be that no MPU-401 device exists, or it could be that one exists but has already been claimed by another driver (that's what it means by "device busy").
Your dmesg shows this:
[ 38.918625] ad1816a 01:01.00: activated [ 38.950576] ad1816a 01:01.01: activated [ 39.958560] MPU-401 device not found or device busy.
I think 01:01.01 is the MPU device on the ad1816a card, so I think the ad1816a driver claimed it, which would prevent the mpu401 driver from claiming it again.
Quoted 6 lines
2. 2626vanilla.txt is the dmesg from a vanilla kernel 2.6.26.1 with
CONFIG_PNP_DEBUGturned on.
It's the only one out of three choices to spurk out correct messages:pnp 01:01.01: ADS7181: calling
quirk_isapnp_mpu_resources+0x0/0x1epnp 01:01.01: adding IRQ-less MPU options
This message appears in both 2626debian.txt and 2626vanilla.txt. In 2627rc1vanilla.txt, that quirk still exists in a slightly different form, but I changed the message to this:
pnp 01:01.01: added dependent option set 2 (same as set 0 except IRQ optional) pnp 01:01.01: added dependent option set 3 (same as set 1 except IRQ optional)
This is more confusing than the "adding IRQ-less MPU options" text, but it means the same thing. I'll try to figure out better wording for this message.
Quoted 6 lines
3. 2627vanilla.txt is the dmesg from a vanilla kernel 2.6.27-rc1 with
CONFIG_PNP_DEBUGturned on.It does not give out any message whether the MPU 401 MIDI device is there, busy, broken or whatever the hell. All it says is tacet - nothing! It appears in the info centre of KDE 4.1 and that's it.
In the 2626vanilla.txt and 2627rc1vanilla.txt logs. it looks like the mpu401 driver is not loaded, so I wouldn't expect any messages. If the mpu401 driver were being registered, we should see a message like this:
pnp: the driver 'mpu401' has been registered
but that doesn't appear in the log, so it's probably just not being loaded. (Note that PNP only prints these messages when CONFIG_PNP_DEBUG is turned on.)
In your 2627rc2vanilla.txt log, we do see that line, together with the "MPU-401 device not found or device busy" line. I think this is because the ad1816a driver has already claimed the MPU, so I don't think this is anything to worry about, other than the fact that the message itself is confusing.
Quoted 3 lines
I swear I like Linux and open source software in general, but sometimes it only nerves and sucks, especially if you are wasting hours to find out that there is one big mess around.
Believe me, I understand your frustration! Software sucks in general. I like Linux because at least I have a chance to try to make it suck a little less :-)
Quoted 2 lines
I also CCed the Debian maintainers with that mail because I suppose that one of their Debian specific kernel patches screwed up that whole thing too.
I don't think this is Debian-related. I added LKML in case anybody else has similar problems.
Quoted 1 line
Please help - let's get this chaos fixed!!
OK, let's back way up. Apart from the confusing messages, it seems like the real problem is related to this modprobe config line:
options parport_pc io=0x378,0x278 irq=7,5
With that line present, I think you have:
parport0 at port 0x378, irq 7
parport1 at port 0x278, irq 5
ad1816a at ports 0x220, 0x388, 0x500, irq 10, dma 1, 3 ad1816a MPU401 at port 0x300, irq disabled
Without that line, it sounds like you have this:
parport0 at port 0x378, irq ?
parport1 at port 0x278, irq disabled (polling) ad1816a at ports 0x220, 0x388, 0x500, irq 5, dma 1, 3 ad1816a MPU401 at port 0x300, irq ? (maybe 7?)
If the parallel ports only have 5 and 7 as IRQ possibilities, I can imagine how loading the ad1816a driver first might claim those IRQs, leaving them unavailable for parport_pc. But all your logs show parport_pc being loaded first. And I would think that if ad1816a were loaded first, it would claim both 5 and 7, leaving *both* parallel ports in polling mode.
If this is indeed the problem, can you send a dmesg for this failing case? (Try "dmesg -s64000"; the first part of the log should show parport resource info, but it is truncated in the logs you posted).
What would you think of something like the patch below? It doesn't fix anything, but maybe it would help show what's going on.
drivers/pnp/quirks.c +1 -0
@@ -182,6 +182,7 @@ static void quirk_add_irq_optional_dependent_sets(struct pnp_dev *dev)unsigned int num_sets, i, set;struct pnp_irq *irq; +dev_info (&dev->dev,"adding MPU configurations with optional IRQ\n" ); num_sets = dev->num_dependent_sets;for (i =0 ; i < num_sets; i++) { new_option =pnp_clone_dependent_set (dev, i);
sound/isa/ad1816a/ad1816a.c +10 -3
@@ -111,14 +111,14 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar acard->devmpu =pnp_request_card_device (card, id->devs[1 ].id,NULL );if (acard->devmpu ==NULL ) { mpu_port[dev] =-1 ; - snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); +dev_warn (&acard->devmpu->dev,"MPU401 device busy, skipping\n" ); } pdev = acard->dev; err =pnp_activate_dev (pdev);if (err <0 ) { - printk(KERN_ERR PFX "AUDIO PnP configure failure\n"); +dev_err (&pdev->dev,"audio PNP configuration failed\n" );return -EBUSY ; }
@@ -127,6 +127,11 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar dma1[dev] =pnp_dma (pdev,0 ); dma2[dev] =pnp_dma (pdev,1 ); irq[dev] =pnp_irq (pdev,0 ); +dev_info (&pdev->dev,"OPL3 FM synth at port %#llx, codec at port %#llx," +" playback DMA %d, capture DMA %d, IRQ %d\n" , + (unsigned long long ) fm_port[dev], + (unsigned long long ) port[dev], + dma1[dev], dma2[dev], irq[dev]);if (acard->devmpu ==NULL )return 0 ;
@@ -135,12 +140,14 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar err =pnp_activate_dev (pdev);if (err <0 ) { - printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); +dev_err (&pdev->dev,"MPU401 PNP configuration failed\n" ); mpu_port[dev] =-1 ; acard->devmpu =NULL ; }else { mpu_port[dev] =pnp_port_start (pdev,0 ); mpu_irq[dev] =pnp_irq (pdev,0 ); +dev_info (&pdev->dev,"MPU401 at port %#llx, IRQ %d\n" , + (unsigned long long ) mpu_port[dev], mpu_irq[dev]); }return 0 ;
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 19 lines · Uwe Bugla
A bit more precise:
Case A:
1. IRQs 7 and 5 reserved for ISA use only (in BIOS)
2. entry "optionsparport_pcio=0x378,0x278 irq=7,5" in etc/modprobe.d/arch/i386 activatedparport0 at port
0x378, irq 7
parport1 at port0x278, irq 5
ad1816a at ports0x200(ns558pnp - gameport),0x388(OPL 2,3), SS at0x500, irq 10, dma 1 & 3
ad1816a MPU401 at port0x300, irq disabledCase B:
same preconditions as above, but:
2. entry "optionsparport_pcio=0x378,0x278 irq=7,5" in etc/modprobe.d/arch/i386 commented out
Quoted 5 lines
parport0 at port
0x378, irq 7
parport1 at port0x278, irq disabled (polling)
ad1816a at ports0x200(ns558pnp - gameport),0x388(OPL 2,3), SS at0x500, irq 5, dma 1 & 3
ad1816a MPU401 at port0x300, irq 10
Thanks a lot for your detailed observations.
Your dmesg logs are still missing the interesting part at the beginning. Can you find the entire log in /var/log/messages or something similar?
These lines are from your case C log, but the same thing probably happened in case B:
parport_pc 00:0a: reported by Plug and Play ACPI
parport0: PC-style at 0x378, irq 7 [PCSPP(,...)] parport_pc 00:0a: driver attached
parport1: PC-style at 0x278 [PCSPP(,...)]
We found parport0 via PNPACPI, but you mentioned that parport1 is a non-PNP ISA card with jumpers on it. In that case, the parport_pc driver doesn't try to use an IRQ unless one is specified with a module parameter. It's possible the driver could guess somehow, but I don't know enough to propose any changes here.
I think you could use "options parport_pc io=0x278 irq=5", i.e., you probably only need to tell the driver about the non-PNP device.
Quoted 10 lines
Case C:
same preconditions as case B, but additionally:
1. no IRQs reserved for ISA use only (in BIOS)
This option I would call "PNP pure"parport0 at port
0x378, irq 7
parport1 at port0x278, irq disabled (polling)
ad1816a at ports0x200(ns558pnp),0x388(OPL 2,3), SS at0x500, irq 5, dma 1 & 3
ad1816a MPU401 at port0x300, irq disabled
The only difference here is that the MPU has no IRQ. You can see from the log how all the possibilities (5, 7, 9, 10, 11, 15) are already used by ad1816a, parport0, and some PCI devices.
With IRQs 5 & 7 reserved for ISA use, PCI device 00:08.0 (aic7xxx) uses IRQ 11. With no IRQs reserved, that device uses IRQ 10. Without the beginning of the log, I can't tell whether Linux or the BIOS changed that assignment.
PNP is supposed to notice IRQs that are in use by active PNP devices, as well as those that could possibly be used, so we can try to avoid them when we configure PCI interrupt links. But it looks like some of this logic is missing from ISAPNP. Can you try the experimental patch below to see whether it helps? It won't change parport, of course, but you might get an MPU IRQ.
Quoted 11 lines
"If the parallel ports only have 5 and 7 as IRQ possibilities, I can imagine how loading the ad1816a driver first might claim those IRQs, leaving them unavailable for
parport_pc."Yes and No.
IRQ 7 for parport 0 is out of discussion, as it is the traditional standard for the first parport.
The traditional problem causing system crashes in earlier times was that both sound card and parport 1 would claim IRQ 5. The decision to put the second parport into polling mode
while the PnP sound card grabs IRQ 5 is wrong.
I don't think the kernel has enough information to make a different decision. The kernel doesn't know anything about the configuration of the non-PNP ISA card. I think you'd have to use a boot parameter like "pnp_reserve_irq=5" to tell Linux that it can't use IRQ 5 when it configures the sound card.
Quoted 6 lines
...
My only criticism within the desired case C (no additional screwing around done by user)
consists of two points:
1. I'd prefer the second parport running with IRQ 5 instead of in polling mode.
Yes, that would be good. But I think the only way to achieve this reliably is to use the "pnp_reserve_irq=5" kernel parameter and the "options parport_pc io=0x278 irq=5" module parameter. Otherwise the kernel doesn't know how the jumpers on the ISA parport card are set.
Quoted 5 lines
2. the state of MPU 401 is OK so far, but the messages are highly annoying:
pnp: the driver 'mpu 401' has been registered
MPU-401 device not found or device busy
pnp: the driver 'mpu 401' has been unregistered
I think we ought to just remove this message completely and add a new message when the driver claims a device, something like the attached patch does.
Quoted 4 lines
...
5. And if you expect some enlighting help fromDocumentation/sound/alsa/ALSA-Configuration.txt then you are completely
lost in space.
I find Linux sound completely incomprehensible myself. Fortunately, it's easy for me to live without it :-)
Bjorn
drivers/pnp/isapnp/core.c +5 -1
@@ -42,6 +42,7 @@#include <linux/init.h> #include <linux/isapnp.h> #include <linux/mutex.h> +#include <linux/pci.h> #include <asm/io.h> #include "../base.h"
@@ -110,6 +111,7 @@ MODULE_LICENSE("GPL");static unsigned char isapnp_checksum_value;static DEFINE_MUTEX (isapnp_cfg_mutex);static int isapnp_csn_count; +static int isapnp_get_resources (struct pnp_dev *dev);/* some prototypes */
@@ -421,7 +423,7 @@ static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card, dev->capabilities |=PNP_READ ; dev->capabilities |=PNP_WRITE ; dev->capabilities |=PNP_DISABLE ; -pnp_init_resources (dev); +isapnp_get_resources (dev);return dev; }
@@ -920,6 +922,8 @@ static int isapnp_get_resources(struct pnp_dev *dev) }for (i =0 ; i <ISAPNP_MAX_IRQ ; i++) { ret =isapnp_read_word (ISAPNP_CFG_IRQ + (i <<1 )) >>8 ; +if (ret) +pcibios_penalize_isa_irq (ret,1 );pnp_add_irq_resource (dev, ret, ret ==0 ?IORESOURCE_DISABLED :0 ); }
sound/drivers/mpu401/mpu401.c +4 -3
@@ -124,6 +124,8 @@ static int __devinit snd_mpu401_probe(struct platform_device *devptr)return err; }platform_set_drvdata (devptr, card); +dev_info (&devptr->dev,"MPU401 UART at port %#lx, IRQ %d\n" , + port[dev], irq[dev]);return 0 ; }
@@ -206,6 +208,8 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,pnp_set_drvdata (pnp_dev, card); snd_mpu401_devices++; ++dev; +dev_info (&pnp_dev->dev,"MPU401 UART at port %#lx, IRQ %d\n" , + port[dev], irq[dev]);return 0 ; }return -ENODEV ;
@@ -271,9 +275,6 @@ static int __init alsa_card_mpu401_init(void) pnp_registered =1 ;if (!snd_mpu401_devices) { -#ifdef MODULE -printk (KERN_ERR "MPU-401 device not found or device busy\n" ); -#endif snd_mpu401_unregister_all ();return -ENODEV ; }
Quoted 13 lines · Bjorn Helgaas
Quoted 11 lines · Uwe Bugla
Case C:
same preconditions as case B, but additionally:
1. no IRQs reserved for ISA use only (in BIOS)
This option I would call "PNP pure"...
My only criticism within the desired case C (no additional screwing around done by user)
consists of two points:
1. I'd prefer the second parport running with IRQ 5 instead of in polling mode.
Quoted 4 lines
Yes, that would be good. But I think the only way to achieve this reliably is to use the "pnp_reserve_irq=5" kernel parameter and the "options
parport_pcio=0x278 irq=5" module parameter. Otherwise the kernel doesn't know how the jumpers on the ISA parport card are set.
One more thing: since you have a non-PNP ISA card, I don't think you can reliably use a "pure PNP" approach. In addition to the kernel and module parameters, I think you need to configure the BIOS to reserve IRQ 5 for ISA use. Otherwise, the BIOS might put some other device on IRQ 5.
Of course, if you are content to run the second parport in polling mode, you wouldn't need the BIOS configuration.
Bjorn
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 18 lines · Uwe Bugla
Am Tuesday 12 August 2008 23:26:12 schrieben Sie:
Quoted 17 lines · Bjorn Helgaas
Quoted 16 lines · Uwe Bugla
Quoted 11 lines
Case C:
same preconditions as case B, but additionally:
1. no IRQs reserved for ISA use only (in BIOS)
This option I would call "PNP pure"...
My only criticism within the desired case C (no additional screwing around done by user)
consists of two points:
1. I'd prefer the second parport running with IRQ 5 instead of in polling mode.Yes, that would be good. But I think the only way to achieve this reliably is to use the "pnp_reserve_irq=5" kernel parameter and the "options
parport_pcio=0x278 irq=5" module parameter.
I see several things that should be fixed in ISAPNP. I'm working on those, but they're probably post-2.6.27 material.
In the meantime, are you seeing new problems that were introduced between 2.6.26 and 2.6.27-rc3? If so, I should try to fix them right away so we can get a fix in 2.6.27.
Your original report of "WARNING: at lib/vsprintf.c:609 vsnprintf+0x36/0x43d()" has been fixed already. I *think* the remaining issues about the parport1 IRQ and the MPU401 are related to the BIOS configuration and the parport_pc module parameters and are not regressions from 2.6.26, but please correct me if I'm wrong.
Thanks for your patience with all this. I'm putting together an ISA machine at home now, so hopefully I'll soon have a way to test this better without wasting your time.
Bjorn