Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp133813ybp; Tue, 8 Oct 2019 15:21:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzinf7dYFzmqhqmLP9AcLpN+EAxATx5K98iwfloAbS0zT2dFmQvAcuKvqTTEe6YP5NuVRjm X-Received: by 2002:aa7:d955:: with SMTP id l21mr259779eds.179.1570573309515; Tue, 08 Oct 2019 15:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570573309; cv=none; d=google.com; s=arc-20160816; b=f9PRlomM+yE1tdrnZZu1yHGTC3VcHi8LaIbHHDoMl7a8IfRTGzcEGbBTlSryK4I2qF YvipPY3jK0tB/I3rFDmXOs+2NwMxsg2CAVAM7TUAoDO6oI9blSu6WAEqsC2YtM4JDAVq tcrCy8y+rtSteuKWyhRBFoRSfmhO8glDhlry01cTXEiJbzxqaQKRuaV3mGfKiBbA/Fzr RTf/l6mivseGknLUvMewouUgWwwXe0Go5xg9LLwl8HnFzYFg53AM946aT0/vfocQ2ywD QlkSHJtoZ3oR81HiybNU1ha7/thF8sCxd39s2KaIXo27U6L9aUcmv6EN9Yf7a/xBWbfW xqIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3cGhRmXoX7em9EGDCBwQCuo/Mdk5iXwJzsobY+LVqP8=; b=nzY5V7itea5uwRS/1CjH60+WDKnmKpqRFQvqU1DjeJHdoE6xrO2dzKdG0MfdrpvSgr mBwrAsVImqPt5oc5kGZ0lmKu/qkD56iagMeUKda+iXdHU5gX83T+riNSPWmyQp+xNIWQ 1fndIs2r3zEw4hFReUt90T/VBqU2uyFsHlludwPZNLmXea92M4Pp4+rTYKGlj8p/cEwa jlf/xOw1HUUJNuC4QUG6MksCZK0XwEfozG20d/N0Inxw/dXCHt6k397gfEOgEYCZy2dx +wJWMDc24vpyGFGT8dbi8P+DVkXn5kxdEePxHm3BIjIudJdxrKKqS4bKA+vMY+8Tl0C8 ywvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U+XLcNgx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si215859edm.158.2019.10.08.15.21.26; Tue, 08 Oct 2019 15:21:49 -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=pass header.i=@chromium.org header.s=google header.b=U+XLcNgx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729524AbfJHWU5 (ORCPT + 99 others); Tue, 8 Oct 2019 18:20:57 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:34886 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbfJHWU5 (ORCPT ); Tue, 8 Oct 2019 18:20:57 -0400 Received: by mail-io1-f68.google.com with SMTP id q10so579809iop.2 for ; Tue, 08 Oct 2019 15:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3cGhRmXoX7em9EGDCBwQCuo/Mdk5iXwJzsobY+LVqP8=; b=U+XLcNgxdPpA0k77YJ8teB2psbrpM6F+e1/FlxKJlocg8hoBUlS7cM7Kb97GD2vnlo SSa2gc//2n8lrx+nRGUFCmg7YUSHVTQofxccijZJjuBQaGG9YsB9SjTxbyI2Y1baUwBz Ij82NUAvuLWtLt3GU0AlbOym7w4xx5ShwJhI4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3cGhRmXoX7em9EGDCBwQCuo/Mdk5iXwJzsobY+LVqP8=; b=gt0Da0acsWMrM6De8wkh8Y5o3oUBNTKnCsMg0EAZzxCVI3in/bYAkEMiLxi0tSTnVy Apu4NAT1Rr+vC+UhNHjlDpikM8r7i/EgT2O+cT9PyGsviZYG7KOw3aQhXbToB9spwgy8 r0Cj7arJ+91v/Er7Aa2CEycEhcuxKWiXzkEjQObH66bqLMIkmHHy3X041qvu9T9ITl5d CWOtRnWH2vLwiqgTwhe7wA33hU+oVEI5saZXLWckWB8KsvMlyww6mpQ2WxXBbcF0m6PW RJaEihhsnH5AX3Gm0xjbiZv7RwdSowVMAwVcakRfQXHQ05Cz0C8QWO4fBkcvTQVpt8m+ QtKQ== X-Gm-Message-State: APjAAAXfuxCNVzHU86tfU+L+S9EVqVm1vJ9olcAUK+vKlgautp3WKSsf Am/LXByGpXDJTLBP/EbCj2aAdCxGGTM= X-Received: by 2002:a6b:7d0b:: with SMTP id c11mr448286ioq.222.1570573255783; Tue, 08 Oct 2019 15:20:55 -0700 (PDT) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com. [209.85.166.49]) by smtp.gmail.com with ESMTPSA id i18sm224114ilc.34.2019.10.08.15.20.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Oct 2019 15:20:55 -0700 (PDT) Received: by mail-io1-f49.google.com with SMTP id v2so464250iob.10 for ; Tue, 08 Oct 2019 15:20:55 -0700 (PDT) X-Received: by 2002:a6b:8a:: with SMTP id 132mr515861ioa.168.1570573254743; Tue, 08 Oct 2019 15:20:54 -0700 (PDT) MIME-Version: 1.0 References: <20191008132043.7966-1-daniel.thompson@linaro.org> <20191008132043.7966-3-daniel.thompson@linaro.org> In-Reply-To: <20191008132043.7966-3-daniel.thompson@linaro.org> From: Doug Anderson Date: Tue, 8 Oct 2019 15:20:41 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/5] kdb: Simplify code to fetch characters from console To: Daniel Thompson Cc: Jason Wessel , kgdb-bugreport@lists.sourceforge.net, LKML , Patch Tracking Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Oct 8, 2019 at 6:21 AM Daniel Thompson wrote: > > Currently kdb_read_get_key() contains complex control flow that, on > close inspection, turns out to be unnecessary. In particular: > > 1. It is impossible to enter the branch conditioned on (escape_delay == 1) > except when the loop enters with (escape_delay == 2) allowing us to > combine the branches. > > 2. Most of the code conditioned on (escape_delay == 2) simply modifies > local data and then breaks out of the loop causing the function to > return escape_data[0]. > > 3. Based on #2 there is not actually any need to ever explicitly set > escape_delay to 2 because we it is much simpler to directly return > escape_data[0] instead. > > 4. escape_data[0] is, for all but one exit path, known to be '\e'. > > Simplify the code based on these observations. > > There is a subtle (and harmless) change of behaviour resulting from this > simplification: instead of letting the escape timeout after ~1998 > milliseconds we now timeout after ~2000 milliseconds > > Signed-off-by: Daniel Thompson > --- > kernel/debug/kdb/kdb_io.c | 38 ++++++++++++++------------------------ > 1 file changed, 14 insertions(+), 24 deletions(-) Looks great. My only comment is that since this was the 2nd patch in the series I spent a whole bunch of time deducing all these same things when reviewing the first patch. :-P Reviewed-by: Douglas Anderson