Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp458409ybm; Fri, 29 May 2020 04:29:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpt1iintXP8nkrOfp0CWS0CL49Cfox/mpFHNIGAb3sWUU7oeV0kFSgqHpSy+3B6hCxT8QC X-Received: by 2002:a17:907:392:: with SMTP id ss18mr7566247ejb.156.1590751767099; Fri, 29 May 2020 04:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590751767; cv=none; d=google.com; s=arc-20160816; b=Yh87uLMkRq/CpfFFC841XGnPp7+SjyR3ZFK7MqXAup6O4XNYCMKpnr3etgGN4VaP8z E9qnoNGBgM+EvUQvFRbItIz84+nClfWmF4RuNCQMuM0udVLGftAML8w1u8+NNqN4oEGO xMLjd+RDPRyeTXTWvG9MBxG3bn+OnzX7wmIumgzCvbayN3eRbaALEG3zxjuoywGac+ei dEX8epNWVzt7fK6PzHB9IyzcyTi5nw/6o1A5X1jYtNdu4IwkwnMeQXIkta0/PdnYL2nY WOYRTQA+ikGPICj/m3tJultLFrSu/36wBFmNt2R7q0MC+Pt3TNpUWscXE6hyw+IiQuIL NXyQ== 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=x3d4hVCjjVp2AvYrfQexVhqf97WQTWR6EO5yWpa4vpw=; b=m8lbLJ90vrt05EVCKlwty2WN4T1QQILK/mQM0EXOhZ00CQq9fXDOfvlo6j9pjEw+ww 6wrdtMN6K1ZHQv/4KM2Q2mrCB6Z6GQa4WlM1ZQTgFohMFHMM9iiFulVzh1azr+tOJqDZ 1Cy8LGP1MCm8Cv9SBw9sWAhMY/dRshNxQbvoljFR1cAc23iQZV3Hnlq9pi3VBM1oAHMh xBGEiu2+c0d2X1G2lUoJAA/wmQkPC5jFePXU6STQHIMITFzF82guXAtQhcWuqvwUqa71 JtVd89VSyYErL/GAU+MWIZsUzk2UsDO/eqtsz2PzcnhLqAeApJ/NBvQnPKlE4OVFtCoH Hj0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rq040eb8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y5si5093797edu.171.2020.05.29.04.29.02; Fri, 29 May 2020 04:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rq040eb8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725808AbgE2L1U (ORCPT + 99 others); Fri, 29 May 2020 07:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgE2L1S (ORCPT ); Fri, 29 May 2020 07:27:18 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41F8BC03E969 for ; Fri, 29 May 2020 04:27:18 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id f21so1352621pgg.12 for ; Fri, 29 May 2020 04:27:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=x3d4hVCjjVp2AvYrfQexVhqf97WQTWR6EO5yWpa4vpw=; b=Rq040eb8C4b2UxywVlI6/jO3R/CgcFFExt5NFZ64qhrUzY7GO2Et+A8WhUXnPhqTVp 8Jhpplvkks9SV0f03ucleVTqvKvawIgRXjMfvl86+sr4bc5HZQUuc9LstDvkEA8ps4Sx V4ZR+1RMHvZSWSLhQSDxDFm+daleqV2OSSq918hJnCmgcEuQV2Hc6m7CJVg8uWetsI7b WeyIICuHwIR0LqQBjpPInzls4+NDEjXaRpOkWxaSzgf+FTE/B2JsLWX3MLlhVjj+J5A6 atYJVS/9+ZRdI5XRsO2jfXAO+1GFdjs2UlZQfN8TPsdoum7NZJN2DHghiPlel/3Qb50y jYGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=x3d4hVCjjVp2AvYrfQexVhqf97WQTWR6EO5yWpa4vpw=; b=rd+AFxACgDNsls226asad0La70L043UzXBM0ifeXlBMJAkZe58LlSAniv457PLSxmI RM7r0dMzTE/5sY1IEa58QxiMOiIAOye9HlYgV4aqn/uCR1pzb4eutE0+t0qBGrA2rnRu Kx7y8Iey1NNoggAKX2TC/loKAewKB25XZxq6irZfPX9wKqPz0tlGktZanYpxjXZ3C9li bwmE4qFP9mPYIhDmeB3chQ6mkqShSRIe830l3q8MhZTI37rnJENuL3BMkGGj5XkyRSWT RpkVEKWthy43zPu1iKJ8FHtH+sPYYz8+bH5gBMWI3ZMSGoa+xfYV6Knwuwb8cgMUtGiH HRYg== X-Gm-Message-State: AOAM5304CiBgC/uacmDyNZ0sfjq6y96RgbPjRAH8K8QY6a6f4irizHYY 4pV+HTwdOpqyuxvbbH3hk3bdUw== X-Received: by 2002:a63:5f11:: with SMTP id t17mr7604547pgb.177.1590751637544; Fri, 29 May 2020 04:27:17 -0700 (PDT) Received: from localhost.localdomain ([117.252.66.248]) by smtp.gmail.com with ESMTPSA id w190sm7016741pfw.35.2020.05.29.04.27.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2020 04:27:16 -0700 (PDT) From: Sumit Garg To: daniel.thompson@linaro.org Cc: kgdb-bugreport@lists.sourceforge.net, jason.wessel@windriver.com, dianders@chromium.org, pmladek@suse.com, sergey.senozhatsky@gmail.com, gregkh@linuxfoundation.org, jslaby@suse.com, linux-kernel@vger.kernel.org, Sumit Garg Subject: [PATCH v4 0/4] kdb: Improve console handling Date: Fri, 29 May 2020 16:56:43 +0530 Message-Id: <1590751607-29676-1-git-send-email-sumit.garg@linaro.org> 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 This patch-set is aimed to improve console handling especially when kdb operates in NMI context. Brief description of enhancements: - Add status check for console prior to invoking corresponding handler. - Fixup to avoid possible deadlock in NMI context due to usage of locks in the console handlers. - Prefer usage of polling I/O driver mode (lockless APIs) over invocation of console handlers. Changes in v4: - Use dbg_io_ops->write_char() directly instead of passing it as a function pointer. - Use "struct console" rather than "struct tty_driver" for comparison. - Make commit descriptions and comments more informative. - Add review tag for patch #2. Changes in v3: - Split patch to have separate patch for console status check. - New patch to re-factor kdb message emit code. - New patch to prefer polling I/O over console mode. - Add code comments to describe usage of oops_in_progress. Changes in v2: - Use oops_in_progress directly instead of bust_spinlocks(). Sumit Garg (4): kdb: Re-factor kdb_printf() message write code kdb: Check status of console prior to invoking handlers kdb: Make kdb_printf() console handling more robust kdb: Switch to use safer dbg_io_ops over console APIs drivers/tty/serial/kgdb_nmi.c | 2 +- drivers/tty/serial/kgdboc.c | 4 +-- drivers/usb/early/ehci-dbgp.c | 3 +- include/linux/kgdb.h | 5 ++- kernel/debug/kdb/kdb_io.c | 76 ++++++++++++++++++++++++++----------------- 5 files changed, 54 insertions(+), 36 deletions(-) -- 2.7.4