Bug 12056

Summary: the serial device(ttyS0) is unuseable after booting the kernel
Product: ACPI Reporter: Shan Wei (shanwei)
Component: Config-HotplugAssignee: ykzhao (yakui.zhao)
Status: CLOSED CODE_FIX    
Severity: normal CC: lenb, rjw, rui.zhang, shanwei, shaohua.li, yakui.zhao
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.28-rc3 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 11808    
Attachments: the .config file
the .config file of 2.6.27
dmesg info on 2.6.28-rc3

Description Shan Wei 2008-11-17 18:44:43 UTC
Latest working kernel version:2.6.28-rc3
Earliest failing kernel version:2.6.28-rc1
Distribution:
Hardware Environment:fujitsu's PG
Software Environment:
Problem Description:

  When i switch to the kernel of 2.6.28-rc3, the serial device 
(ttyS0) is unused. But on 2.6.27, it's ok. 

On 2.6.28-rc3:
[root@DaVid compiler]# setserial /dev/ttyS0
/dev/ttyS0, UART: unknown, Port: 0x03f8, IRQ: 4

On 2.6.27:
[root@DaVid compiler]# setserial /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4

  The problem comes from this patch 39a0ad871000d2a016a4fa113a6e53d22aabf25d。
For the device that is not present but functional, it unload the driver for the device. 
  In the following patch, I try to fix it whthout check the present bit when adding device. After applied the patch, the serial device is useable again.

diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 383e47c..bcc731b 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -154,7 +154,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 	 */
 	status = acpi_get_handle(device->handle, "_CRS", &temp);
 	if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
-	    is_exclusive_device(device) || (!device->status.present))
+	    is_exclusive_device(device))
 		return 0;
 
 	dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device));

Steps to reproduce:
1)build the kernel of 2.6.28-rc3;
2)check the device with “setserial /dev/ttyS0”
Comment 1 Anonymous Emailer 2008-11-17 18:53:45 UTC
Reply-To: akpm@linux-foundation.org


(switched to email.  Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Mon, 17 Nov 2008 18:44:44 -0800 (PST) bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=12056
> 
>            Summary: the serial device(ttyS0) is unuseable after booting the
>                     kernel
>            Product: ACPI
>            Version: 2.5
>      KernelVersion: 2.6.28-rc3
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: blocking
>           Priority: P1
>          Component: ACPICA-Core
>         AssignedTo: acpi_acpica-core@kernel-bugs.osdl.org
>         ReportedBy: shanwei@cn.fujitsu.com
> 
> 
> Latest working kernel version:2.6.28-rc3
> Earliest failing kernel version:2.6.28-rc1
> Distribution:
> Hardware Environment:fujitsu's PG
> Software Environment:
> Problem Description:
> 
>   When i switch to the kernel of 2.6.28-rc3, the serial device 
> (ttyS0) is unused. But on 2.6.27, it's ok. 
> 
> On 2.6.28-rc3:
> [root@DaVid compiler]# setserial /dev/ttyS0
> /dev/ttyS0, UART: unknown, Port: 0x03f8, IRQ: 4
> 
> On 2.6.27:
> [root@DaVid compiler]# setserial /dev/ttyS0
> /dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
> 
>   The problem comes from this patch
>   39a0ad871000d2a016a4fa113a6e53d22aabf25d___
> For the device that is not present but functional, it unload the driver for
> the
> device. 
>   In the following patch, I try to fix it whthout check the present bit when
> adding device. After applied the patch, the serial device is useable again.
> 
> diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
> index 383e47c..bcc731b 100644
> --- a/drivers/pnp/pnpacpi/core.c
> +++ b/drivers/pnp/pnpacpi/core.c
> @@ -154,7 +154,7 @@ static int __init pnpacpi_add_device(struct acpi_device
> *device)
>          */
>         status = acpi_get_handle(device->handle, "_CRS", &temp);
>         if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
> -           is_exclusive_device(device) || (!device->status.present))
> +           is_exclusive_device(device))
>                 return 0;
> 
>         dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device));
> 
> Steps to reproduce:
> 1)build the kernel of 2.6.28-rc3;
> 2)check the device with ___setserial /dev/ttyS0___
> 
> 
Comment 2 ykzhao 2008-11-17 19:10:55 UTC
Will you please attach the output of acpidump, dmesg?
Will you please try the boot option of "pnpacpi=off" on the 2.6.27 working kernel and see whether the ttyS0 can be used?
Comment 3 Shan Wei 2008-11-17 19:14:46 UTC
五島殿

  Forward the mail to you.
  If i miss something, welcome you comment.


Andrew Morton says:
> (switched to email.  Please respond via emailed reply-to-all, not via the
> bugzilla web interface).
> 
> On Mon, 17 Nov 2008 18:44:44 -0800 (PST) bugme-daemon@bugzilla.kernel.org
> wrote:
> 
>> http://bugzilla.kernel.org/show_bug.cgi?id=12056
>>
>>            Summary: the serial device(ttyS0) is unuseable after booting the
>>                     kernel
>>            Product: ACPI
>>            Version: 2.5
>>      KernelVersion: 2.6.28-rc3
>>           Platform: All
>>         OS/Version: Linux
>>               Tree: Mainline
>>             Status: NEW
>>           Severity: blocking
>>           Priority: P1
>>          Component: ACPICA-Core
>>         AssignedTo: acpi_acpica-core@kernel-bugs.osdl.org
>>         ReportedBy: shanwei@cn.fujitsu.com
>>
>>
>> Latest working kernel version:2.6.28-rc3
>> Earliest failing kernel version:2.6.28-rc1
>> Distribution:
>> Hardware Environment:fujitsu's PG
>> Software Environment:
>> Problem Description:
>>
>>   When i switch to the kernel of 2.6.28-rc3, the serial device 
>> (ttyS0) is unused. But on 2.6.27, it's ok. 
>>
>> On 2.6.28-rc3:
>> [root@DaVid compiler]# setserial /dev/ttyS0
>> /dev/ttyS0, UART: unknown, Port: 0x03f8, IRQ: 4
>>
>> On 2.6.27:
>> [root@DaVid compiler]# setserial /dev/ttyS0
>> /dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
>>
>>   The problem comes from this patch
>>   39a0ad871000d2a016a4fa113a6e53d22aabf25d___
>> For the device that is not present but functional, it unload the driver for
>> the
>> device. 
>>   In the following patch, I try to fix it whthout check the present bit when
>> adding device. After applied the patch, the serial device is useable again.
>>
>> diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
>> index 383e47c..bcc731b 100644
>> --- a/drivers/pnp/pnpacpi/core.c
>> +++ b/drivers/pnp/pnpacpi/core.c
>> @@ -154,7 +154,7 @@ static int __init pnpacpi_add_device(struct acpi_device
>> *device)
>>          */
>>         status = acpi_get_handle(device->handle, "_CRS", &temp);
>>         if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
>> -           is_exclusive_device(device) || (!device->status.present))
>> +           is_exclusive_device(device))
>>                 return 0;
>>
>>         dev = pnp_alloc_dev(&pnpacpi_protocol, num,
>>         acpi_device_hid(device));
>>
>> Steps to reproduce:
>> 1)build the kernel of 2.6.28-rc3;
>> 2)check the device with ___setserial /dev/ttyS0___
>>
>>
> 
Comment 4 ykzhao 2008-11-17 19:24:28 UTC
Will you please attach the .config file?
Thanks.
Comment 5 Shan Wei 2008-11-17 19:50:11 UTC
Created attachment 18903 [details]
the .config file

the .config file of 2.6.28-rc3
Comment 6 Shan Wei 2008-11-17 19:56:45 UTC
(In reply to comment #2)
> Will you please attach the output of acpidump, dmesg?

> Will you please try the boot option of "pnpacpi=off" on the 2.6.27 working
> kernel and see whether the ttyS0 can be used?
> 
oh i just now try it again. with the option the ttyS0 is unuseable.
Comment 7 ykzhao 2008-11-17 21:16:33 UTC
Please attach the output of acpidump, dmesg.
It will be great if you can attach the .config file for 2.6.27 working kernel.
Thanks.
Comment 8 Shan Wei 2008-11-17 22:05:33 UTC
Created attachment 18904 [details]
the .config file of 2.6.27

the .config file of 2.6.27.
Comment 9 Shan Wei 2008-11-17 22:14:01 UTC
Created attachment 18905 [details]
dmesg info on 2.6.28-rc3

I don't know which is meaningless to u, So attach the whole dmesg infos in booting the kernel.
Comment 10 ykzhao 2008-11-19 17:42:35 UTC
Hi, ShanWei
    Thanks for the test and config file.
    From the test result it seems that the ttyS0 device depends on the some specific PNP device.
    If the PNP device is not present but functional, it is still added into
the PNP device tree on the 2.6.27 kernel. In such case OS will try to load the PNP device driver for it. If there exists the _SRS object, it will be evaluated to activate the inactive PNP device(The enable bit of _STA is zero).

   If the PNP device is not present, it won't be added into the PNP device
tree on the 2.6.28-rc3 kernel. In such case OS can't load the PNP device driver for the corresponding PNP device. Of course the _SRS object won't be evaluated again. It brings that the ttyS0 device is unusable. 

   This issue is opposite to that in bug 3358. On the box of bug 3358 if the device is still added into the PNP device tree, there exists the conflict between two PNP devices. So it won't be added into the PNP device tree if the PNP device is not present but functional. In such case OS won't load the PNP device driver for it.
    
   In fact according to the ACPI spec OS should not load the device driver for it if the ACPI device is not present but functional.

   Thanks.
Comment 11 Shan Wei 2008-11-19 22:25:04 UTC
(In reply to comment #10)
> Hi, ShanWei
>     Thanks for the test and config file.
>     From the test result it seems that the ttyS0 device depends on the some
> specific PNP device.
>     If the PNP device is not present but functional, it is still added into
> the PNP device tree on the 2.6.27 kernel. In such case OS will try to load
> the
> PNP device driver for it. If there exists the _SRS object, it will be
> evaluated
> to activate the inactive PNP device(The enable bit of _STA is zero).
> 
>    If the PNP device is not present, it won't be added into the PNP device
> tree on the 2.6.28-rc3 kernel. In such case OS can't load the PNP device
> driver
> for the corresponding PNP device. Of course the _SRS object won't be
> evaluated
> again. It brings that the ttyS0 device is unusable. 
> 
>    This issue is opposite to that in bug 3358. On the box of bug 3358 if the
> device is still added into the PNP device tree, there exists the conflict
> between two PNP devices. So it won't be added into the PNP device tree if the
> PNP device is not present but functional. In such case OS won't load the PNP
> device driver for it.
> 
>    In fact according to the ACPI spec OS should not load the device driver
>    for
> it if the ACPI device is not present but functional.
> 

Thanks for you reply.

Yes. According the spec, the kernel of 2.6.28-rc3 is ok.

We found that the BIOS provides the option to specify the base I/O address and
IRQ. Enable the option, with the kernel of 2.6.28-rc3, the ttyS0 is usable.

So the bugzilla can be closed now.
Thank you all the same.