From patchwork Wed Nov 11 08:03:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alim Akhtar X-Patchwork-Id: 7594481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E7294BF90C for ; Wed, 11 Nov 2015 08:04:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F01DB20631 for ; Wed, 11 Nov 2015 08:04:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 961932053D for ; Wed, 11 Nov 2015 08:04:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZwQMf-0001QF-In; Wed, 11 Nov 2015 08:02:45 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZwQMc-0001Ig-BL for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2015 08:02:43 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NXN02A5X4ZVWK90@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2015 17:02:19 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.124]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id CE.3B.05385.B06F2465; Wed, 11 Nov 2015 17:02:19 +0900 (KST) X-AuditID: cbfee691-f79d66d000001509-7c-5642f60b8ff6 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 27.F6.23663.A06F2465; Wed, 11 Nov 2015 17:02:18 +0900 (KST) Received: from [107.108.73.28] by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NXN007VT4ZALXV0@mmp2.samsung.com>; Wed, 11 Nov 2015 17:02:18 +0900 (KST) Message-id: <5642F64B.3030801@samsung.com> Date: Wed, 11 Nov 2015 13:33:23 +0530 From: Alim Akhtar User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-version: 1.0 To: mark.rutland@arm.com, lorenzo.pieralisi@arm.com, linux-arm-kernel Subject: PSCI: NULL pointer dereference X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsWyRsSkRpf7m1OYwYITnBabHl9jtXjz+wW7 xdLrF5kcmD3WzFvD6LF5SX0AUxSXTUpqTmZZapG+XQJXxqL/71kLPstUHF1o2sB4V6KLkZND QsBEYufzOewQtpjEhXvr2boYuTiEBFYwShy/N4O5i5EDrOjUaTWI+CxGiTNf/jJDOA8YJdbf eQbWzSugJfHswGRWEJtFQFViwYRGsDibgLbE3elbmEAGiQpESDy+IARRLijxY/I9FhBbRCBP Yv0HiFZhAXWJhqVPwFqZBawlVk7axghhy0tsXvMWbK+EwGc2iUuPpzJB7BKQ+Db5EAvEobIS mw4wQzwjKXFwxQ2WCYzCs5Csm4Vk7CwkYxcwMq9iFE0tSC4oTkovMtUrTswtLs1L10vOz93E CAzy0/+eTdzBeP+A9SFGAQ5GJR7eCBunMCHWxLLiytxDjKZAV0xklhJNzgfGUl5JvKGxmZGF qYmpsZG5pZmSOK+O9M9gIYH0xJLU7NTUgtSi+KLSnNTiQ4xMHJxSDYyJKxlXfShbp/xgpbbp 7fttpuesz3XUh1/scuQRDG7y+izC1FcxT3xDhsE95w93OSq/232QMAxerL016O1x5uWVhnsv NcS5Z14LvNg/Kbh1wZ6L890zGBObIiJDOt+2fMhliG6dUsziZLdhp6ryJLtCJ8W/T/vZLv4U KnP7kXfV60vyDJf53UosxRmJhlrMRcWJAABy+LNtAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsVy+t9jQV2ub05hBruuWFtsenyN1eLN7xfs FkuvX2RyYPZYM28No8fmJfUBTFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbm Sgp5ibmptkouPgG6bpk5QEuUFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1GBmggYQ1 jBmL/r9nLfgsU3F0oWkD412JLkYODgkBE4lTp9W6GDmBTDGJC/fWs3UxcnEICcxilDjz5S8z hPOAUWL9nWfsIFW8AloSzw5MZgWxWQRUJRZMaASLswloS9ydvoUJZKioQITE4wtCEOWCEj8m 32MBsUUE8iTWf4BoFRZQl2hY+gSslVnAWmLlpG2MELa8xOY1b5knMPLOQtI+C0nZLCRlCxiZ VzFKpBYkFxQnpeca5qWW6xUn5haX5qXrJefnbmIER9IzqR2MB3e5H2IU4GBU4uHdYOcUJsSa WFZcmXuIUYKDWUmE1+4EUIg3JbGyKrUoP76oNCe1+BCjKdB/E5mlRJPzgVGeVxJvaGxibmps amliYWJmqSTOq+9pFCYkkJ5YkpqdmlqQWgTTx8TBKdXAuEhburNYzEly2kxhTuXVSdufp4Vp FXUyf1dzSVZvTDjy6L/6+8nupy8Y3GaScw7efH7qKjdD2/ronv2O+1TP/7Zb4pu7wkSSTyT/ 2QZGw/ID6ht+RayRTmaJ8rB03jPb353ryG/1VMkaEV6peQFeBmcXJklNK9aW+Zees9Sk7HlD 5/cFPJVKLMUZiYZazEXFiQC0q5W4ugIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151111_000242_554903_4DF9BCCA X-CRM114-Status: GOOD ( 13.29 ) X-Spam-Score: -7.2 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Mark/Lorenzo, Getting a NULL pointer dereference from psci_0_2_set_functions() like [1]. But this goes away with a addition of a printk (see blow diff) or a udelay(10) with the same firmware on the board. My firmware returns PSCI_E_NOT_SUPPORTED for psci_migrate() and PSCI_TOS_NOT_PRESENT_MP for psci_migrate_info_type(). Any idea, what going wrong? Why adding a print or delay always works? [1]: ============== psci: probing for conduit method from DT. psci: PSCIv0.2 detected in firmware. psci: Using standard PSCI v0.2 function IDs Unable to handle kernel NULL pointer dereference at virtual address 00000be8 pgd = ffffffc00097f000 [00000be8] *pgd=0000000000000000, *pud=0000000000000000 Internal error: Oops: 96000045 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 4.3.0-next-20151109+ #13 task: ffffffc0008d1100 ti: ffffffc0008c4000 task.ti: ffffffc0008c4000 PC is at psci_0_2_init+0x90/0x290 LR is at psci_0_2_init+0x84/0x290 pc : [] lr : [] pstate: 600002c5 sp : ffffffc0008c7eb0 x29: ffffffc0008c7eb0 x28: 0000000000000000 x27: ffffffc002000000 x26: ffffffc0008d28b0 x25: ffffffc0007680b8 x24: ffffffc0008d2000 x23: ffffffc0008d75b0 x22: 0000000000000000 x21: 0000000000000000 x20: 0000000000000bb8 x19: 0000000000000000 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000006 x11: 0000000000000000 x10: 000000000000000f x9 : 0000000000000010 x8 : 6620322e30762049 x7 : ffffffc0008caa58 x6 : 0000000000000001 x5 : ffffffc0003bfda4 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 0000000000000001 x1 : ffffffc0004c77bc x0 : 000000000000002b Process swapper (pid: 0, stack limit = 0xffffffc0008c4020) Stack: (0xffffffc0008c7eb0 to 0xffffffc0008c8000) 7ea0: ffffffc0008c7ee0 ffffffc00084e6cc 7ec0: ffffffc0befe5f80 ffffffc0009524a8 ffffffc0008d2ab0 ffffffc0008e0000 7ee0: ffffffc0008c7f00 ffffffc00082b618 ffffffc0befe5f80 ffffffc00089c708 7f00: ffffffc0008c7fa0 ffffffc000828668 0000000000000001 ffffffc000861d80 7f20: 0000000048000000 0000000000000000 ffffffc0008ca000 0000000040000000 7f40: 000000004097c000 000000004097f000 ffffffc000081198 00000000ffffffc8 7f60: 000000008f065000 ffffffc0005d80a0 0000000000000001 0000000048000000 7f80: ffffffffffffffff 0000000000000000 0000000000000080 fefefefefefefefe 7fa0: 0000000000000000 00000000405d4000 000000008f065000 0000000000000e11 7fc0: 0000000048000000 0000000000000000 0000000000000000 0000000040000000 7fe0: 0000000000000000 ffffffc0008625a8 0000000000000000 0000000000000000 Call trace: [] psci_0_2_init+0x90/0x290 [] psci_dt_init+0x2c/0x3c [] setup_arch+0x384/0x550 [] start_kernel+0x98/0x3b8 [<00000000405d4000>] 0x405d4000 Code: 97e3c1ec b0ffe3c1 912ee2b4 911ef021 (f9001a81) ---[ end trace cb88537fdc8fa200 ]--- Kernel panic - not syncing: Attempted to kill the idle task! ---[ end Kernel panic - not syncing: Attempted to kill the idle task! diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index d24f35d74b27..92a0798e4138 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -312,6 +312,7 @@ static void __init psci_0_2_set_functions(void) psci_function_id[PSCI_FN_CPU_OFF] = PSCI_0_2_FN_CPU_OFF; psci_ops.cpu_off = psci_cpu_off; + pr_info("Using standard PSCI v0.2 function IDs CPU_OFF\n"); psci_function_id[PSCI_FN_CPU_ON] = PSCI_FN_NATIVE(0_2, CPU_ON); psci_ops.cpu_on = psci_cpu_on;