Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1522340ybk; Thu, 21 May 2020 08:50:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySLYsL3uHc30OoSY7CzthdOcz7/fxxaobwztINNt0OAA4m00JVi9Y1exAVTFBk7nwbvs/Q X-Received: by 2002:a17:906:f8f:: with SMTP id q15mr4266411ejj.389.1590076211981; Thu, 21 May 2020 08:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590076211; cv=none; d=google.com; s=arc-20160816; b=IO6/iBraZtDfogackc6YdBQnIVF8T3I8q4ntjNkoh6XDXwqpgDpWXw86khzlh5JWb2 sKuNmvaECMvvPJEWi8FmNJr9Nsf4xozLgvxVP0Vtr8w3uNZnzkGwhXr4ORJp8UOTo6Ef aohvomwwfttOFMtmPnnSg+kMeklwxC0I+XFEFqLOZz4woo/nx/2ys2srvTFmbqIde6HT 7R7DXGCQ7K5+jMuXKHpj2CdwPo1aMO5TvA37LDn5ntYz2nXTbWhgf8vFSWwflDTvzSRK zDXF5ow1QT8AUB+UjVn1T3UrlMu9fkiMSXuAnKA4dOzu/uSuYVSafRINgdHSgHugv/lA raAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ygXdshwZ6sqhNV/RMFYuAUef1d1MehMWLgDXSG2EHPs=; b=rK/Fu9UsF0QN0bCEr0mWYaOtGiDIAr5KDtoZftrsFktqjW5SHredl2dMlzWOa2vDbb cqC1eyraecyXAx2pTpO1gUkSDtMHsx/vJWO+plYI2Xq7nUuaPckSb+jAWeBb6eYhQleC VuSE7EiSB4mnzZ6zxBKhAqb3l4NrOBvZfaSw6cDMEFrOdtJRcQ+9Fqndy7OpLWHhM2F/ fT/phIg2697csW+WLBKEWn4sL8SoPSVZW0oACcbWFx4yIoRcxup4n/Cj1bIr213D/YN9 tV8RefPToB0yON6ZPIu7WIi9wpuH+N58WB4DgC3NN44maEjdT0SGhdFzG8XCoYxGwOwP 9SeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Le6cJcuo; 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 h7si3451647eja.367.2020.05.21.08.49.49; Thu, 21 May 2020 08:50:11 -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=Le6cJcuo; 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 S1727961AbgEUPrp (ORCPT + 99 others); Thu, 21 May 2020 11:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbgEUPrp (ORCPT ); Thu, 21 May 2020 11:47:45 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 822D2C061A0E for ; Thu, 21 May 2020 08:47:43 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id n5so6858207wmd.0 for ; Thu, 21 May 2020 08:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ygXdshwZ6sqhNV/RMFYuAUef1d1MehMWLgDXSG2EHPs=; b=Le6cJcuobanbwKgpp8zSivcyXze9t07R/UHYuERqTibtsy7X/7SAiRx3kKbE9q+2t7 a8LBUq/lE7CMVR3EFaUHcSr6o0pkzVkQudm8mbe8Brwi3sfop8yoJ0l/GyFhcrZqAQ89 OOtxQ24xQK1ODH4tvY+VAqxgZEWS0RFpiQGMo1SvpLsrxxJNEyA/2/ly+qvNOrvJDcnb DJeOIaYP2xcpraV7aoTkNImBo83FCkvNbnqOlSTZk5cESrtBKP1XP9WZ/MsN9k+v2K4a Uyhm1gX5Cn6BH6d+FSF9oaRhFniCeNWam4cS6kt+Om7gD86vLeCEhg32UKpaUKqtbDPb zKEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ygXdshwZ6sqhNV/RMFYuAUef1d1MehMWLgDXSG2EHPs=; b=e4gjaAQOenkJ75/4/r+medt7tew2IE9OErYMtOAVcH7QA6nhtf+qobYruUkwKDndfZ UaOvO/mkpFg9+GNCVhnBHKQ3PY8tj7dNNrxwR6XA4FgjOysSLhgbhi54D4mvNr5La11v oLjJoI9QnLflei+2spcQ2cMKVJjEh3WOBkoy8IBhQuA8tiZCf80vw3IjmFrPTlWUNhwX UN7ah3xsfZ5ew6mq8p41dCSqtsGV0rYQvnk6dZElR+RTKki/q2zwfdKSbExiYCvn7efb 6H/4u02bJN2BXZ8aZ5Qq3twujlrg0j/GNyEGbYcHeszbY3XBna+8OvZMzmcH1zlyxNIW oq2w== X-Gm-Message-State: AOAM531orW1JghCjJRBIKlNbyKnisc/gDCCHa5Qrmx3YKGxmTfN7+70N ZrNJ96l4f65zxwm+hmLMWFDn4L244qA= X-Received: by 2002:a7b:c205:: with SMTP id x5mr9933734wmi.135.1590076062001; Thu, 21 May 2020 08:47:42 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id a10sm7076374wmf.46.2020.05.21.08.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 08:47:40 -0700 (PDT) Date: Thu, 21 May 2020 16:47:39 +0100 From: Daniel Thompson To: Wei Li Cc: Doug Anderson , Jason Wessel , Masahiro Yamada , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [Kgdb-bugreport] [PATCH v3] kdb: Remove the misfeature 'KDBFLAGS' Message-ID: <20200521154739.ukfro4uuxpmnrpsx@holly.lan> References: <20200521072125.21103-1-liwei391@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200521072125.21103-1-liwei391@huawei.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 21, 2020 at 03:21:25PM +0800, Wei Li wrote: > Currently, 'KDBFLAGS' is an internal variable of kdb, it is combined > by 'KDBDEBUG' and state flags. It will be shown only when 'KDBDEBUG' > is set, and the user can define an environment variable named 'KDBFLAGS' > too. These are puzzling indeed. > > After communication with Daniel, it seems that 'KDBFLAGS' is a misfeature. > So let's replace 'KDBFLAGS' with 'KDBDEBUG' to just show the value we > wrote into. After this modification, we can use `md4c1 kdb_flags` instead, > to observe the state flags. > > Suggested-by: Daniel Thompson > Signed-off-by: Wei Li > --- > v2 -> v3: > - Change to replace the internal env 'KDBFLAGS' with 'KDBDEBUG'. > v1 -> v2: > - Fix lack of braces. > > kernel/debug/kdb/kdb_main.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c > index 4fc43fb17127..392029287083 100644 > --- a/kernel/debug/kdb/kdb_main.c > +++ b/kernel/debug/kdb/kdb_main.c > @@ -418,8 +418,7 @@ int kdb_set(int argc, const char **argv) > argv[2]); > return 0; > } > - kdb_flags = (kdb_flags & > - ~(KDB_DEBUG_FLAG_MASK << KDB_DEBUG_FLAG_SHIFT)) > + kdb_flags = (kdb_flags & ~KDB_DEBUG(MASK)) > | (debugflags << KDB_DEBUG_FLAG_SHIFT); > > return 0; > @@ -2081,7 +2080,8 @@ static int kdb_env(int argc, const char **argv) > } > > if (KDB_DEBUG(MASK)) > - kdb_printf("KDBFLAGS=0x%x\n", kdb_flags); > + kdb_printf("KDBDEBUG=0x%x\n", > + (kdb_flags & KDB_DEBUG(MASK)) >> KDB_DEBUG_FLAG_SHIFT); For this expression to work correctly, kdb_flags, need to be unsigned (otherwise we get an arithmetic right shift and mis-report when KDBDEBUG == 0xfff). This is just FYI, I think I can fix this up when applying... Daniel.