Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp585406ybm; Wed, 27 May 2020 03:03:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxF1X5MnSmrUlkQoNXVZ1hqqiyI6hxuX9L1IEF+jg57jDzs1XfAy53bujjPMJSbBGXYHN1 X-Received: by 2002:a50:ec83:: with SMTP id e3mr24086882edr.349.1590573802571; Wed, 27 May 2020 03:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590573802; cv=none; d=google.com; s=arc-20160816; b=UaD7UGSy0DOB1Ql/TO2ZhVREodzfI79rz0wtb3IsdNMTJVGDqupz7e+K9VxBGMFHqa 8s+HT+WtgU454sc5uRb6LoMxWw2BVUg6OZD5Rs8oxramadojzyYd3pSiIBFAGJw9H19X 8l8+bixzMk7Zipsdiv648dFj9qSQTklfJUOoGgoi+ZzEn46Lm51MsIvJnvujQYPFrS5O pnJp5Ceoyqlaw1qyWceVxQwHXKec8D3gd4xfeBZ8Nx7VeIwXQruLOVSJ8/nfERasTbk+ qjtYlSBI5B52xP91vaYBtObJEg5scl47S6aTC4mWySx56mXf1OxELW7aB3Y7dMLr7SSH 5Nig== 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=NFiMTgw0ePYgZ5AyHST8V5BcX0V74DYgO0bygQd/V6E=; b=AXsC3BZRwobjcsbXY65BOu8JTLlRcSPL2iuPV14WazWCoPrYdOwmnPVDysz4GEuKS9 sR3C040hqyMaMemicYnN+ukfiv88v+IM0He7PQhTrDk8OfRCo8r0TySsKeMeI05xc6Fj yN10RHKib5Iaq6bV06P3AqU6N8b0FitSigopisXL/DneBNFQAkPcph1PO7ECiaz3QOLf jsJN0eObE7q1cnMXw1QDSCFbz3o+4JSSwGmSK8X9uJpmhmxFLUuruhxNp9UOIEXygMxs QwYdvU9qygxQzLTXdd+k/jptVsL60vtrNCMEqJ5jQNC0T2/eEo9npLzE31YyO0dTjnKE L7gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W1TUEkRQ; 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 dr19si2237398ejc.90.2020.05.27.03.02.59; Wed, 27 May 2020 03:03:22 -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=W1TUEkRQ; 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 S1728437AbgE0G0f (ORCPT + 99 others); Wed, 27 May 2020 02:26:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728003AbgE0G0e (ORCPT ); Wed, 27 May 2020 02:26:34 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B56EDC061A0F for ; Tue, 26 May 2020 23:26:34 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id z15so812611pjb.0 for ; Tue, 26 May 2020 23:26:34 -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=NFiMTgw0ePYgZ5AyHST8V5BcX0V74DYgO0bygQd/V6E=; b=W1TUEkRQ5Et/Gi/4hnXRc57eLV8qfnmL/DpnDGe/EEnVdgwb2b4l8jZoerXxO+frUA 6ElMY5TVa0KQLO045gdJZKmMzZJqqHRNdYMiiPDGkg5A2zwgXl0CrqGAaiMpATKxoLPt aYs4H0zLKP5YRKR9sWl6d2HsiXgOjKkFb/521j0ZHSvDIbK61iHeTFkW85nCaO54N1eX 0OMr55J9Y/oSaNG9vTG0ovEjuU/oYbAY0LFFUF7/N7Xw6TKEFxSz/g0vUl+8OZo6xkCT bQ28cMt6uD+F7MqZyTfq2fS3hl5QxXCCuhJWXGjdGyVG6e2Mwa9DNb5w4DpeGE4yRw8V U6uQ== 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=NFiMTgw0ePYgZ5AyHST8V5BcX0V74DYgO0bygQd/V6E=; b=lF4g+VIrs/HElaYXZkoDjs/4nIJykjuVOocpjSVaoLXk/vHsTP6Li9OSMHOGwAEUjX 4HZmUu6w622eIVgToRYjkd9cBdpV3+u9DPB5XgGBzlm6oo7bhyg13FOZPTXiuPAEYEDR 8Fz/QT+vCeiLiyhF5TLsXJr/QFpU/VyX90UYEUv4ylH9ua4EmtNZD7FjUxcsysWg2AXG uNOKoiV/WG91kVLFusstmiJLo+HhcEPYv8vihyJzJyTIIfVbAFxC2qcrIAifb6OzLvmr eQWPMF2U2b7nfm3k+HAkMDoTqAiFH9HqPVLEO8D26D7HfH6lFcVig4XuadHpT6hclz2J s74g== X-Gm-Message-State: AOAM5339BABtZ99zz+uzsjX1q6Uxzxbz8xCiNSEeN5kWOU0INv/Vd8zp 4yd110ZNP+bk+/WrOWhGd7qE3g== X-Received: by 2002:a17:902:9a4a:: with SMTP id x10mr4620273plv.343.1590560794197; Tue, 26 May 2020 23:26:34 -0700 (PDT) Received: from localhost.localdomain ([117.252.68.136]) by smtp.gmail.com with ESMTPSA id m12sm1239121pjs.41.2020.05.26.23.26.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 May 2020 23:26:33 -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, linux-kernel@vger.kernel.org, Sumit Garg Subject: [PATCH v3 0/4] kdb: Improve console handling Date: Wed, 27 May 2020 11:55:55 +0530 Message-Id: <1590560759-21453-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 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 robust to run in NMI context kdb: Switch kdb_msg_write() to use safer polling I/O drivers/tty/serial/kgdboc.c | 17 ++++----- include/linux/kgdb.h | 2 + kernel/debug/kdb/kdb_io.c | 91 ++++++++++++++++++++++++++++++--------------- 3 files changed, 72 insertions(+), 38 deletions(-) -- 2.7.4