From patchwork Tue Dec 18 18:53:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 10736215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8185813AD for ; Tue, 18 Dec 2018 18:54:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 727F229595 for ; Tue, 18 Dec 2018 18:54:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 669832962C; Tue, 18 Dec 2018 18:54:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D901829595 for ; Tue, 18 Dec 2018 18:54:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 645F78E0007; Tue, 18 Dec 2018 13:54:15 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5CF3B8E0001; Tue, 18 Dec 2018 13:54:15 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 497F08E0007; Tue, 18 Dec 2018 13:54:15 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id F17978E0001 for ; Tue, 18 Dec 2018 13:54:14 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id b17so15941726pfc.11 for ; Tue, 18 Dec 2018 10:54:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version; bh=Gx0bhRcL1WgzGx4uAcAoVMGOjdr6FfRTNvKocFLifVU=; b=AlEwasbyoZC3psrgNr1E4VIGUZHszev82LS/6SObLWPwojU/BIrkOzMbFWNfyJKNmq rtLTGts5oDNU+rmExWvgxJxGZW/RaAGyCJsfNSXJCrh+OjnvX9etZ+BVRt+00+mf1hFx RuqfH12/fM5M8M4MVejcCenI6CuNkJP9PvOTZhTNoStPLuy0k68+UFwEKaQEOqduc4Ey HqMwVOB1jvO9NHOhF6ohYGw86nBRjPqllt22iZ5kEkEUrBkAsS1MCxf1gmCUcL5J9qRK ygsSdjV9+nPNwIkIBALIemDnL6uN7hFUrlU3mHt949KiUNFbOwOVXcoweoXZmirkKcWq N8dg== X-Gm-Message-State: AA+aEWYyUU24mq60ulG2zi1yvCQs7IOD3ZDDXK1WvrRGDtkNMHrPGP79 gwo/nwWObGBKh0fPmLY6MoFDm7wgOARDfhwGrQcbjqgSd+xfIWjdB8k8sngJEEYwwAhx6aCJRpx QzbCRECMjXx+3h4nhWv4m4o2PWm09y6Ds7YAKIpiokb1zTvr3O6CaFw19paVM7qCQVw== X-Received: by 2002:a65:590b:: with SMTP id f11mr16831371pgu.60.1545159254615; Tue, 18 Dec 2018 10:54:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/VjJttuWLubb9h+vB/apHQLIXRp3NSPWlbdZ2eCb9SP3F6AFqTpnQnJEPPg1x2x5XwoNCJW X-Received: by 2002:a65:590b:: with SMTP id f11mr16831314pgu.60.1545159253429; Tue, 18 Dec 2018 10:54:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545159253; cv=none; d=google.com; s=arc-20160816; b=G3eOltaKxXA1Ga8EjMF45dTbX5sK03EUP5tyXWccdD4ri2l0VaLnLFP4oGiIMJPmx/ B6IObYSs7Sv1m9jbZE1VI1I8h15O9yrpjpaV3sg2qYOAof1dNzTy8etjtZi8M79Tpub5 Bic1GUXd2aiSQsjBg6CICo7whFJEHRGkDuZ0QqdcXM4yhfQgdAwthYOgxzi+mFaRbyzC EZtTkIEt+bTKxtgXoOGsotCRSLWSlinnQc0LiB2MNIOps7snRqUrJBn8Pj33bM80g0op GstWEBpgAoK/pU0O7KwfoWo/mmG3qDCZnpSGf0MiCd9MT4F0lJzreu88f18KzPuxyMid zoLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Gx0bhRcL1WgzGx4uAcAoVMGOjdr6FfRTNvKocFLifVU=; b=s06If33GLY8XGGqUFf1mLIKzSkLabI598/x0wAIxs5fpRzIyRvfIRu2xPxwxkdAw16 u1sVHL5nK647MeMvJ3Whav0kDuqu4ui2/ikz7PSceHX3nsTZagNTMEGwIZANr3yAn991 Kq+F/HjnykIBZrraV8ojktE4lMsUiEjPVmnydLAZjtJzUOTUSy1ZRmPyCDkGUoZXlCQ+ ndrVaHAwRYwd2Dt+H9G6Eujp/UcfnGkJZ3wqAsJdLiD2kOAYwC9BkOVQeiOSExYyxRS2 tSQ2MJTKbAdUwK1YQ4wf5AB9ZNN9iCai7iUzYxtxCc62vkzBP0txZJbsXjXinPsLePQA t0rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=ThMzo9sz; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from smtprelay.synopsys.com (smtprelay.synopsys.com. [198.182.60.111]) by mx.google.com with ESMTPS id z20si13629875pgv.159.2018.12.18.10.54.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 10:54:13 -0800 (PST) Received-SPF: pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) client-ip=198.182.60.111; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=ThMzo9sz; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id CE13710C0BCA; Tue, 18 Dec 2018 10:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1545159252; bh=Dmmf92XTwIVxBegyy3MkhN2/6mGU00jYdmv+BDLE/IE=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=ThMzo9szwxcID/+P7MyBY/Cp9ofIE1KLDillTJ6gm35dEj7gaNI20io/OOShc3jMq HFi8LPMi7C514pAxxkClHW9kfDDQTW0QrqEP8U1Xx3mp7qWTple8eGMBLoSdZSLZ7f U1c6CuGUnOgI0Ydhcpo9IGy8U5CbvmOiAK5L8GV+yk/20cUKoQEocfmgcUZP+I0jeu 6NoTRUA/JMqutWgZJ/rGKP/BHXRKHKYhyQEvc1LSyz+hqpPAIycMy2vTxlAejo1aEz rDgohiU8PLyIueCutbIETbIKBpJd+cK8dMdx9mBUZxqoYeOrz6HEoOktmSKsdrSVPs P0ttPOcpmUTbw== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id AE4A0399B; Tue, 18 Dec 2018 10:54:12 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 18 Dec 2018 10:54:12 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 00:24:11 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.70) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 00:24:11 +0530 From: Vineet Gupta To: CC: , , , Peter Zijlstra , "Vineet Gupta" Subject: [PATCH 1/2] ARC: show_regs: avoid page allocator Date: Tue, 18 Dec 2018 10:53:58 -0800 Message-ID: <1545159239-30628-2-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545159239-30628-1-git-send-email-vgupta@synopsys.com> References: <1545159239-30628-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.10.161.70] X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Use on-stack smaller buffers instead of dynamic pages. The motivation for this change was to address lockdep splat when signal handling code calls show_regs (with preemption disabled) and ARC show_regs calls into sleepable page allocator. | potentially unexpected fatal signal 11. | BUG: sleeping function called from invalid context at ../mm/page_alloc.c:4317 | in_atomic(): 1, irqs_disabled(): 0, pid: 57, name: segv | no locks held by segv/57. | Preemption disabled at: | [<8182f17e>] get_signal+0x4a6/0x7c4 | CPU: 0 PID: 57 Comm: segv Not tainted 4.17.0+ #23 | | Stack Trace: | arc_unwind_core.constprop.1+0xd0/0xf4 | __might_sleep+0x1f6/0x234 | __get_free_pages+0x174/0xca0 | show_regs+0x22/0x330 | get_signal+0x4ac/0x7c4 # print_fatal_signals() -> preempt_disable() | do_signal+0x30/0x224 | resume_user_mode_begin+0x90/0xd8 Despite this, lockdep still barfs (see next change), but this patch still has merit as in we use smaller/localized buffers now and there's less instructoh trace to sift thru when debugging pesky issues. Signed-off-by: Vineet Gupta Reviewed-by: William Kucharski --- arch/arc/kernel/troubleshoot.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index e8d9fb452346..2885bec71fb8 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c @@ -58,11 +58,12 @@ static void show_callee_regs(struct callee_regs *cregs) print_reg_file(&(cregs->r13), 13); } -static void print_task_path_n_nm(struct task_struct *tsk, char *buf) +static void print_task_path_n_nm(struct task_struct *tsk) { char *path_nm = NULL; struct mm_struct *mm; struct file *exe_file; + char buf[256]; mm = get_task_mm(tsk); if (!mm) @@ -80,10 +81,9 @@ static void print_task_path_n_nm(struct task_struct *tsk, char *buf) pr_info("Path: %s\n", !IS_ERR(path_nm) ? path_nm : "?"); } -static void show_faulting_vma(unsigned long address, char *buf) +static void show_faulting_vma(unsigned long address) { struct vm_area_struct *vma; - char *nm = buf; struct mm_struct *active_mm = current->active_mm; /* can't use print_vma_addr() yet as it doesn't check for @@ -96,8 +96,11 @@ static void show_faulting_vma(unsigned long address, char *buf) * if the container VMA is not found */ if (vma && (vma->vm_start <= address)) { + char buf[256]; + char *nm = "?"; + if (vma->vm_file) { - nm = file_path(vma->vm_file, buf, PAGE_SIZE - 1); + nm = file_path(vma->vm_file, buf, 256-1); if (IS_ERR(nm)) nm = "?"; } @@ -173,13 +176,8 @@ void show_regs(struct pt_regs *regs) { struct task_struct *tsk = current; struct callee_regs *cregs; - char *buf; - - buf = (char *)__get_free_page(GFP_KERNEL); - if (!buf) - return; - print_task_path_n_nm(tsk, buf); + print_task_path_n_nm(tsk); show_regs_print_info(KERN_INFO); show_ecr_verbose(regs); @@ -189,7 +187,7 @@ void show_regs(struct pt_regs *regs) (void *)regs->blink, (void *)regs->ret); if (user_mode(regs)) - show_faulting_vma(regs->ret, buf); /* faulting code, not data */ + show_faulting_vma(regs->ret); /* faulting code, not data */ pr_info("[STAT32]: 0x%08lx", regs->status32); @@ -221,8 +219,6 @@ void show_regs(struct pt_regs *regs) cregs = (struct callee_regs *)current->thread.callee_reg; if (cregs) show_callee_regs(cregs); - - free_page((unsigned long)buf); } void show_kernel_fault_diag(const char *str, struct pt_regs *regs, From patchwork Tue Dec 18 18:53:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 10736217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31048924 for ; Tue, 18 Dec 2018 18:54:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2231429589 for ; Tue, 18 Dec 2018 18:54:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16272295B7; Tue, 18 Dec 2018 18:54:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A952529589 for ; Tue, 18 Dec 2018 18:54:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 339718E000A; Tue, 18 Dec 2018 13:54:19 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2C2EF8E0001; Tue, 18 Dec 2018 13:54:19 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18EF38E000A; Tue, 18 Dec 2018 13:54:19 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id C04918E0001 for ; Tue, 18 Dec 2018 13:54:18 -0500 (EST) Received: by mail-pl1-f198.google.com with SMTP id b24so12537870pls.11 for ; Tue, 18 Dec 2018 10:54:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version; bh=6R41jBjC0odWkKxchuCxIvvNe1FEJ8P9XFqNcU5syJo=; b=The8geH4uVLK7yU5rmcN92yoig7CiYNCCmX4p/SMu+1jJS6ibcUaHMs4uj8klji7zB qncrt1FizZd/6C6Jw/PnqLVxkFHw8QJkpJbV3KUAQqEwxijcCc3MMF5bUVe287ms+VD7 4GysEEbxwLMqchW1aNnyz3izurSgT2yL6/zCe6wHnq/Kva1LjWAsDOfmURRhzhGYFaAG GvAq5Umhb5EICJBAG5BTSuKItnSYL+nt9NjJE+pKfMzPWYqa4bt/M6CkOFjeEUlA2B8n CobXO/pLqQ/gtbUvfbATiC1giUZWehwN+Hy51uq2LxCE3c9gRmTO6ZkhdZUlC55qRFgt 6twg== X-Gm-Message-State: AA+aEWaIhXh2Hc8ACo7MWfarsb0vArycXcwIw3yh1rSyXewwgegl1t3+ kfYXOPfLH9tH1RdpJNQwgNG9b7uDH7kK6cdhKqUEBzXF2UJRN+RFFZHWVjsFKxFY2EjcZhTGtY3 wCY9kE1f+HN7qaWrjWC9hOZM7pGktEsTjIq1Zc4CFPnS17nt4it4xJncHTevnQRGT6g== X-Received: by 2002:a17:902:622:: with SMTP id 31mr17151615plg.171.1545159258402; Tue, 18 Dec 2018 10:54:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/UQvblpKHVrwcNuYpQu2bFwCzmZWIA9Jdfz1hdyToRR+BvBzfAJ0nfsIadE4Kpu/IjPDAly X-Received: by 2002:a17:902:622:: with SMTP id 31mr17151584plg.171.1545159257717; Tue, 18 Dec 2018 10:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545159257; cv=none; d=google.com; s=arc-20160816; b=cKWjMSbadZ1ymu60hIl7Qzc8m4ka0T+VNl0UjkBAyYOmE7wIRhLncAy88MqgDkYcmO vD/eaxAT9tTMKtUDpq9zUwBq9sBp00KykYYwkTvjivU7EM8iZd8eLilNSwDBRKMkaNfM VDGfU/oZoKzM/aox/NBofubLr46eUxGiKeuJ9oMLH3ly12AUKJeCR1SJqve1URmFiqNg N9Jp8osNv4bUiIH3vt1Ayi6nCbtIsa6ZmuIWf0hqRtCqV+fmn49hdPDuq4L2p5tpXht5 U80IkH69yZmvIOH5bSLoMwRc5NoKi7hm8PDYGV7WwK3DI1NpTFomkEJCjNaZ9hcwlFhJ ap7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6R41jBjC0odWkKxchuCxIvvNe1FEJ8P9XFqNcU5syJo=; b=VQzldJo+zEaQaG6GzEoY9tnjL3WDGL4x7ivduvNqPiVvWr2eh1NfbF+rmvw7GRhEdN kpGt6OZLk0JSN+Eo1VCybX2wpDJJeE/mmFoagjHRYvBDKWTGeBoXeE2gsfe+U6QkU5Ac XpE6tAqVlim5b95++uynOMUY47aJXthvYEMAHYLhurvrbnvhz4N0yompFFZd2Si7ay6d RDWqa8nqCkHQLafta5q7ZgxpWunROGOLZ+xO97TUVAE675FBQ1MQjDCYbq006kHYS1rD G5+99jcmx8VeR5xCXrdfzEjNQ53Z2QSMIHkETzQ2KDMRVvFFhwyIepkduOsaC8ljTICi ZKZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=AbtvNVXP; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.47.9 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from smtprelay.synopsys.com (us01smtprelay-2.synopsys.com. [198.182.47.9]) by mx.google.com with ESMTPS id t3si10655638pgg.403.2018.12.18.10.54.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 10:54:17 -0800 (PST) Received-SPF: pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.47.9 as permitted sender) client-ip=198.182.47.9; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=AbtvNVXP; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.47.9 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 3CD8924E2808; Tue, 18 Dec 2018 10:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1545159257; bh=9sw3xXmZzMD2r1pq0e6toINGoyuET/YizCJnsRVXBDc=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=AbtvNVXP9+o791uc/g/C/uYcKKKenE1jeDHA/Q9Jf1C9W059a2cTbOfff22ukJdMr 37EO4b0elciThdTl4xZg+NFwe51fWOFFyZ7WMlh83E8wX/ajbZu6ekjH1QHNc4gdXq XYQ0NOaNLUWq7rljmUE86+TLr2VoqtztIvThK/0YN03P3+WeqMaLn2Pq/MrJCwIvjA kahcV6OU3NzQ++DI/nKzaL4my7ZXf48Q86ODGw1bmr1unNQpMEGln1Y0dR7HS53hi6 iJZEAi7dcQumqCOmk+Wr8RHk1AEdD26X8jisV28B/OV+Ujr1pkMH98dST+aIkrDINt yRRSc0w+mHCJA== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 2460E5422; Tue, 18 Dec 2018 10:54:17 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 18 Dec 2018 10:54:17 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 00:24:14 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.70) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 00:24:13 +0530 From: Vineet Gupta To: CC: , , , Peter Zijlstra , "Vineet Gupta" Subject: [PATCH 2/2] ARC: show_regs: fix lockdep splat for good Date: Tue, 18 Dec 2018 10:53:59 -0800 Message-ID: <1545159239-30628-3-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545159239-30628-1-git-send-email-vgupta@synopsys.com> References: <1545159239-30628-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.10.161.70] X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP signal handling core calls ARCH show_regs() with preemption disabled which causes __might_sleep functions such as mmput leading to lockdep splat. Workaround by re-enabling preemption temporarily. This may not be as bad as it sounds since the preemption disabling itself was introduced for a supressing smp_processor_id() warning in x86 code by commit 3a9f84d354ce ("signals, debug: fix BUG: using smp_processor_id() in preemptible code in print_fatal_signal()") Signed-off-by: Vineet Gupta --- arch/arc/kernel/troubleshoot.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index 2885bec71fb8..c650d3de13e1 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c @@ -177,6 +177,12 @@ void show_regs(struct pt_regs *regs) struct task_struct *tsk = current; struct callee_regs *cregs; + /* + * generic code calls us with preemption disabled, but some calls + * here could sleep, so re-enable to avoid lockdep splat + */ + preempt_enable(); + print_task_path_n_nm(tsk); show_regs_print_info(KERN_INFO); @@ -219,6 +225,8 @@ void show_regs(struct pt_regs *regs) cregs = (struct callee_regs *)current->thread.callee_reg; if (cregs) show_callee_regs(cregs); + + preempt_disable(); } void show_kernel_fault_diag(const char *str, struct pt_regs *regs,