Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp258551imm; Tue, 25 Sep 2018 21:06:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV60X7kvLWzwkjbgA6OMYYXy/5BWoy5RvIzAHyi+9hPj/7zTMFbkQPz2KeQxezzUL6T87jBUP X-Received: by 2002:a63:3dc6:: with SMTP id k189-v6mr3761127pga.191.1537934807532; Tue, 25 Sep 2018 21:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537934807; cv=none; d=google.com; s=arc-20160816; b=tqaK2sC6viF5OjRz/khAlVfi4HWhnPtvWV9WPa5R5NT5VRzw5BMKHJyGBzH8cbSYxY HBEUJpSQey1MzPEZ5+eqlZulBBNNJQDYmuC69eOm/sSjwC0TECJVY+GsvBO2rSrieYdY kzRi9BHxkKVaW/FKJHE4GCAb8GQO8WlDaodsyvDi5k8oER5TkhNT/yYUkmQ4TtM0PsWJ gWRACkxY4hEDRXraw4pPL7kc5fvHqhXTJt49Cj6KofmNx5TNysQyqKRXcGuSK0NAxAmF muTBNrOSEx6KsuQOKycx3rlzwKdBydB7lOukwHZPLiYARCeCyuMyaAEr0mcKj1Gj43ph JMtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=JB4vxpq/yk9VnoWpJJyeyQdY5KPFoZgKRzKBFu+9ZmY=; b=0LSJKGSDnJEpHoB0yerqls2PmDYrzdAX5aEG0ktAyAEzFgs8Ef2Z8fSNMMKZwlLDeP qfMFxhq8f+l855OY6Ivl2uD5cljR8dz3Zbh0r3p8BzI9WWgdezTKvXmoLKdriGok9tjG vYYOnf3zIZ6gDCvOPT0SSUMh2WiYerJPvPGAGY9+mhfIxdudtyjrfRxUMMPoU5GDRyvv WLMGtBkfBg5p4V4sCK6Fk17QAO6oiWAvEFP6SJqw6DB5svnAh8hJwrTBJHFmIxjP/OBu gZpFT4KfMtNWMtR+LESvpmBq3t4Fi7cHkQYDwY3XUX0zA30fu1SAUBV+Xb1jb/eId3gF bdQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="J/HsbXN4"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k25-v6si4435585pgn.375.2018.09.25.21.06.31; Tue, 25 Sep 2018 21:06:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="J/HsbXN4"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726346AbeIZKRV (ORCPT + 99 others); Wed, 26 Sep 2018 06:17:21 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46612 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbeIZKRV (ORCPT ); Wed, 26 Sep 2018 06:17:21 -0400 Received: by mail-pg1-f196.google.com with SMTP id b129-v6so13099946pga.13; Tue, 25 Sep 2018 21:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=JB4vxpq/yk9VnoWpJJyeyQdY5KPFoZgKRzKBFu+9ZmY=; b=J/HsbXN4MJMaq+VkBbmnGoN0eotE1A+qEeKCY3paYjjMTE35P2mUFh1rVK2lZc4/mS 7pU8AzF7zkMDnzZm/c8jJKPfLmH27O0yt9SqYZgRpO88l9zhkc1KopgTEeOdL4YAq+nX yFOiCbvRJ8DWbkLzZPk5dQmWW8gv+48nzgGkigNCouvWs5FywgfLUlzatIQ6TECZK1EA l/k3qN1O5zGFZNF1RedmP8sqNabQulDpFVqLdvjBXfumQVWfsO970eFqRarjWJnz2k1p XJe4ea4zkWvpQ5uTPcJ52AGS8P0DzdD5dKyPAbmN2l/Koc9oqGoKg4PWZurB5FB49H5c OAog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=JB4vxpq/yk9VnoWpJJyeyQdY5KPFoZgKRzKBFu+9ZmY=; b=Uemzl/LfFG/k2DDU3GSnnDCfGXXmANMUiEqO46CLmH/WDRVKFhABjN5UagKP3uAZQF INL8fjpryifzaavMWH+1wR3tmLh/qzQXjqQfLHvvW6zKcBLGVT2Iltuxzm/b7w5YR0N2 rQSQHUSOATAeQapRoXS1xx0k3US1LJaph8hozCTwtZo339WrxvgnQsy7wighyNJUepFI lUOX1T2VfLdNKnc3zThLCYdlJVMNMg0urHwjECpCn6sy6C0calSxvG7D5UsY+CQUao7E fPALrheMncTc3AF06o1DtTHAdJyrB994joej4YlcIyEhs02y8Bd+4K1xqDpxdMwagFQR 1Izg== X-Gm-Message-State: ABuFfoiQL3QnoOzEokjmIAMXbk7Bvukj/TpMR31/gf4o1+8kQe3EEcNW DT3EB7GORxfkY0jqX21TFkg= X-Received: by 2002:a63:e0e:: with SMTP id d14-v6mr3856280pgl.38.1537934787621; Tue, 25 Sep 2018 21:06:27 -0700 (PDT) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id 26-v6sm5458404pfs.168.2018.09.25.21.06.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Sep 2018 21:06:26 -0700 (PDT) From: Guenter Roeck To: Frank Rowand Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH v2] of: unittest: Disable interrupt node tests for old world MAC systems Date: Tue, 25 Sep 2018 21:06:24 -0700 Message-Id: <1537934784-19819-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On systems with OF_IMAP_OLDWORLD_MAC set in of_irq_workarounds, the devicetree interrupt parsing code is different, causing unit tests of devicetree interrupt nodes to fail. Due to a bug in unittest code, which tries to dereference an uninitialized pointer, this results in a crash. OF: /testcase-data/phandle-tests/consumer-a: arguments longer than property Unable to handle kernel paging request for data at address 0x00bc616e Faulting instruction address: 0xc08e9468 Oops: Kernel access of bad area, sig: 11 [#1] BE PREEMPT PowerMac Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.72-rc1-yocto-standard+ #1 task: cf8e0000 task.stack: cf8da000 NIP: c08e9468 LR: c08ea5bc CTR: c08ea5ac REGS: cf8dbb50 TRAP: 0300 Not tainted (4.14.72-rc1-yocto-standard+) MSR: 00001032 CR: 82004044 XER: 00000000 DAR: 00bc616e DSISR: 40000000 GPR00: c08ea5bc cf8dbc00 cf8e0000 c13ca517 c13ca517 c13ca8a0 00000066 00000002 GPR08: 00000063 00bc614e c0b05865 000affff 82004048 00000000 c00047f0 00000000 GPR16: c0a80000 c0a9cc34 c13ca517 c0ad1134 05ffffff 000affff c0b05860 c0abeef8 GPR24: cecec278 cecec278 c0a8c4d0 c0a885e0 c13ca8a0 05ffffff c13ca8a0 c13ca517 NIP [c08e9468] device_node_gen_full_name+0x30/0x15c LR [c08ea5bc] device_node_string+0x190/0x3c8 Call Trace: [cf8dbc00] [c007f670] trace_hardirqs_on_caller+0x118/0x1fc (unreliable) [cf8dbc40] [c08ea5bc] device_node_string+0x190/0x3c8 [cf8dbcb0] [c08eb794] pointer+0x25c/0x4d0 [cf8dbd00] [c08ebcbc] vsnprintf+0x2b4/0x5ec [cf8dbd60] [c08ec00c] vscnprintf+0x18/0x48 [cf8dbd70] [c008e268] vprintk_store+0x4c/0x22c [cf8dbda0] [c008ecac] vprintk_emit+0x94/0x130 [cf8dbdd0] [c008ff54] printk+0x5c/0x6c [cf8dbe10] [c0b8ddd4] of_unittest+0x2220/0x26f8 [cf8dbea0] [c0004434] do_one_initcall+0x4c/0x184 [cf8dbf00] [c0b4534c] kernel_init_freeable+0x13c/0x1d8 [cf8dbf30] [c0004814] kernel_init+0x24/0x118 [cf8dbf40] [c0013398] ret_from_kernel_thread+0x5c/0x64 The problem was observed when running a qemu test for the g3beige machine with devicetree unittests enabled. Disable interrupt node tests on affected systems to avoid both false unittest failures and the crash. With this patch in place, unittest on the affected system passes with the following message. dt-test ### end of unittest - 144 passed, 0 failed Fixes: 53a42093d96ef ("of: Add device tree selftests") Signed-off-by: Guenter Roeck --- v2: Do not use goto to skip tests. Provide test log in commit message. drivers/of/unittest.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 722537e14848..41b49716ac75 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -771,6 +771,9 @@ static void __init of_unittest_parse_interrupts(void) struct of_phandle_args args; int i, rc; + if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) + return; + np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); if (!np) { pr_err("missing testcase data\n"); @@ -845,6 +848,9 @@ static void __init of_unittest_parse_interrupts_extended(void) struct of_phandle_args args; int i, rc; + if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) + return; + np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); if (!np) { pr_err("missing testcase data\n"); @@ -1001,15 +1007,19 @@ static void __init of_unittest_platform_populate(void) pdev = of_find_device_by_node(np); unittest(pdev, "device 1 creation failed\n"); - irq = platform_get_irq(pdev, 0); - unittest(irq == -EPROBE_DEFER, "device deferred probe failed - %d\n", irq); + if (!(of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)) { + irq = platform_get_irq(pdev, 0); + unittest(irq == -EPROBE_DEFER, + "device deferred probe failed - %d\n", irq); - /* Test that a parsing failure does not return -EPROBE_DEFER */ - np = of_find_node_by_path("/testcase-data/testcase-device2"); - pdev = of_find_device_by_node(np); - unittest(pdev, "device 2 creation failed\n"); - irq = platform_get_irq(pdev, 0); - unittest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq); + /* Test that a parsing failure does not return -EPROBE_DEFER */ + np = of_find_node_by_path("/testcase-data/testcase-device2"); + pdev = of_find_device_by_node(np); + unittest(pdev, "device 2 creation failed\n"); + irq = platform_get_irq(pdev, 0); + unittest(irq < 0 && irq != -EPROBE_DEFER, + "device parsing error failed - %d\n", irq); + } np = of_find_node_by_path("/testcase-data/platform-tests"); unittest(np, "No testcase data in device tree\n"); -- 2.7.4