From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: [RFC PATCH] acpi/xen: Evaluate the _PDC properly (for 2.6.32, and 2.6.39) Date: Wed, 15 Jun 2011 09:46:16 -0400 Message-ID: <20110615134615.GA7529@dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: bderzhavets@yahoo.com, ke.yu@intel.com, carsten@schiers.de, JBeulich@novell.com, Jeremy Fitzhardinge , xen-devel@lists.xensource.com, tom.goetz@virtualcomputer.com List-Id: xen-devel@lists.xenproject.org I was trying to bring up an prototype box and it while it booted fine und= er Linux, if I tried to do it under Dom0 with a modified Linux kernel it cra= shed. By modified I mean it had the "xen/acpi: add xen acpi processor driver" p= atch in it. I traced it down to a one line fix which fixed the issue. It might make sense to back-port this to the 2.6.32 tree, and it _might_ = fix some problems folks had with the processor_xen module (CC-ed here). If yo= u see a similar stack trace to the one outlined in the patch - then you mig= ht be hitting this bug. Anyhow, I am not that familiar with Linux ACPI parser or how the P states are exposed - so it might be that this patch is completly bogus. Feedback would be much appreciated. commit 498adade0091900564e6a6bf06a0f793f09d4764 Author: Konrad Rzeszutek Wilk Date: Tue Jun 14 21:44:35 2011 -0400 acpi/xen: Evaluate the _PDC properly. =20 The call to evaluate the _PDC was passing in the wrong argument. =20 Instead of passing in the acpi_handle it was passing in the structure that held the acpi_handle as the second member. This can cause the wrong evaluation on some machines ending up in trying to evaluate the _PDC and dereferencing the prefix node (which is not part of that structure) and causing a NULL pointer exception. =20 The results after running with this patch (and yes, there are no _PDC on this box): =20 nsxfeval-0180 [2017820672] [4294967276] evaluate_object : ----E= ntry nsxfeval-0359 [2017820672] [4294967276] evaluate_object : ----E= xit- ****Exception****: AE_BAD_PARAMETER processor_core-0306 [2017820672] [4294967275] processor_eval_pdc := Could not evaluate _PDC, using legacy perf. control. nsxfeval-0180 [2017820672] [4294967276] evaluate_object : ----E= ntry nsxfeval-0263 [2017820672] [4294967276] evaluate_object : pathn= ame is [_PPC] nseval-0090 [2017820672] [4294967277] ns_evaluate : ----E= ntry nsutils-0707 [2017820672] [4294967278] ns_get_node : ----E= ntry ffffffff8173d637 nsutils-0391 [2017820672] [4294967279] ns_internalize_name : ----E= ntry nsutils-0280 [2017820672] [4294967280] ns_build_internal_name: ----E= ntry =20 Without the patch (I enabled tracing here so there are more details, note the prefix scope): =20 nsxfeval-0180 [2017820672] [4294967276] evaluate_object : ----E= ntry utcopy-0641 [2017820672] [4294967277] ut_copy_eobject_to_iob: ----E= ntry utcopy-0459 [2017820672] [4294967278] ut_copy_esimple_to_isi: ----E= ntry utobject-0097 [2017820672] [4294967279] ut_create_internal_obj: ----E= ntry Buffer utobject-0385 [2017820672] [4294967280] ut_allocate_object_des: ----E= ntry utobject-0401 [2017820672] [4294967280] ut_allocate_object_des: ffff8= 800779748b8 Size 48 utobject-0403 [2017820672] [4294967280] ut_allocate_object_des: ----E= xit- ffff8800779748b8 utobject-0146 [2017820672] [4294967279] ut_create_internal_obj: ----E= xit- ffff8800779748b8 utcopy-0552 [2017820672] [4294967278] ut_copy_esimple_to_isi: ----E= xit- AE_OK utcopy-0656 [2017820672] [4294967277] ut_copy_eobject_to_iob: ----E= xit- AE_OK nsxfeval-0263 [2017820672] [4294967276] evaluate_object : pathn= ame is [_PDC] nseval-0090 [2017820672] [4294967277] ns_evaluate : ----E= ntry nsutils-0707 [2017820672] [4294967278] ns_get_node : ----E= ntry ffffffff81733097 nsutils-0391 [2017820672] [4294967279] ns_internalize_name : ----E= ntry nsutils-0280 [2017820672] [4294967280] ns_build_internal_name: ----E= ntry nsutils-0363 [2017820672] [4294967280] ns_build_internal_name: Retur= ning [ffff880069151ef0] (rel) "_PDC" nsutils-0366 [2017820672] [4294967280] ns_build_internal_name: ----E= xit- AE_OK nsutils-0419 [2017820672] [4294967279] ns_internalize_name : ----E= xit- AE_OK utmutex-0255 [2017820672] [4294967278] ut_acquire_mutex : Threa= d 2017820672 attempting to acquire Mutex [ACPI_MTX_Namespace] osl-0973 [2017820672] [4294967278] os_wait_semaphore : Waiti= ng for semaphore[ffff88007f004280|1|65535] osl-0992 [2017820672] [4294967278] os_wait_semaphore : Acqui= red semaphore[ffff88007f004280|1|65535] utmutex-0263 [2017820672] [429496= 7278] ut_acquire_mutex : Thread 2017820672 acquired Mutex [ACPI_MTX_= Namespace] nsaccess-0301 [2017820672] [4294967279] ns_lookup : ----E= ntry nsutils-0663 [2017820672] [4294967280] ns_opens_scope : ----E= ntry Untyped nsutils-0673 [2017820672] [4294967280] ns_opens_scope : ----E= xit- 0000000000000000 nsaccess-0398 [2017820672] [4294967279] ns_lookup : Searc= hing relative to prefix scope [=FF=FF=FF=FF] (ffff880069163800) nsaccess-0510 [2017820672] [4294967279] ns_lookup : Simpl= e Pathname (1 segment, Flags=3D2) nsdump-0087 [2017820672] [4294967279] ns_print_pathname : [_PDC= ] nssearch-0297 [2017820672] [4294967280] ns_search_and_enter : ----E= ntry nssearch-0102 [2017820672] [4294967281] ns_search_one_scope : ----E= ntry nsnames-0139 [2017820672] [4294967282] ns_get_external_pathna: ----E= ntry ffff880069163800 BUG: unable to handle kernel NULL pointer dereference at 000000000000= 0418 IP: [] acpi_ns_get_pathname_length+0x1f/0x68 .. snip.. Pid: 1, comm: swapper Not tainted 2.6.39.1-00221-gbb09547 #1 Intel Co= rporation S2600CP/S2600CP .. snip.. Call Trace: [] acpi_ns_get_external_pathname+0x38/0x137 [] acpi_ns_search_one_scope+0x4b/0x1f5 [] acpi_ns_search_and_enter+0x131/0x42f [] acpi_ns_lookup+0x4c8/0x6c9 [] acpi_ns_get_node+0xe8/0x16e [] acpi_ns_evaluate+0x83/0x3b6 [] acpi_evaluate_object+0x1f9/0x35b [] ? kmem_cache_alloc_trace+0xa0/0xb0 [] acpi_processor_set_pdc+0x1cc/0x226 [] xen_acpi_processor_add+0x45c/0x59d =20 Signed-off-by: Konrad Rzeszutek Wilk diff --git a/drivers/acpi/processor_xen.c b/drivers/acpi/processor_xen.c index 43760f8..db54525 100644 --- a/drivers/acpi/processor_xen.c +++ b/drivers/acpi/processor_xen.c @@ -311,7 +311,7 @@ static int __cpuinit xen_acpi_processor_add(struct ac= pi_device *device) } =20 /* _PDC call should be done before doing anything else (if reqd.). */ - acpi_processor_set_pdc(pr); + acpi_processor_set_pdc(pr->handle); =20 #ifdef CONFIG_CPU_FREQ xen_acpi_processor_ppc_has_changed(pr);