Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp518967ybv; Wed, 5 Feb 2020 09:32:10 -0800 (PST) X-Google-Smtp-Source: APXvYqy6tzB1i3XNbP5zA5i4mGI/KTgBv09Bl+z93T250sMf7uOXtif/XmoGeoyUbYk+Kxw2ci50 X-Received: by 2002:aca:5248:: with SMTP id g69mr3656060oib.106.1580923930656; Wed, 05 Feb 2020 09:32:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580923930; cv=none; d=google.com; s=arc-20160816; b=lj0rMOLkDHJGAYr/WqJCxoVICk2oq+FqsE8N34Suvid4+QqeqYZpyTWI2vzE1ETUjM EeeFfRCJTfzvxID6jHkw+Ut9N534q+4UAdjrvw5sgZSly5/kxDdwtpnm7Z74PoYMqD6e dcJNtwiSqdQm9ajQ68Q49zoKi4nyFj/DNiujEd7xne+S/RvT4/dmc1RmPr++J0T899bf /EMyCC30nNRiuKVbzRbQT3Qzs1jArm3KLpxwwRkOYlzqYkUvKdq/Cn50SNP3aHUoV/KU NBTQpjD7LiPbJXJZv5a/nQDsQzI+b43nWx0AwLjabK823vpJTBBBKAGGxAy/c8h9ufpN 3e9w== 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=BA/wxTBKBRtXyBJptwlCXymjnHMIAT83JNQdcmKZ7GY=; b=pF8YAzTq8f1rBFA5YB82nmiYn4DGunzhmNveciHM6VQLMtnMxTeVschhg1wKVofthy +vCW63h/c+Vo1B1otb7EdYJ5xNPFwng+BKMWRbs1mzerPiPfdJJl//SY6h2RmlhspJtu kRa5lUIdo757/qQktyqiFugTzH0hOJMDlDg9aJtwHoKIbFhAxF2eOqJ8P1wKwaF7dMjY WOHYtA8+Y/MAcYNKP1KhEqEq594ZCatWnSfujccjyWOcSNM9qc6T7EYoaJmKg++Y/Qc+ iZr+b2j0ejVsfefbtyYr4fAbcDS8QoqEBBFdXkD/rN8dBji60qEPDPP3TsUAWZ44A36k fuKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UpL5Z4PG; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si442863oie.196.2020.02.05.09.31.57; Wed, 05 Feb 2020 09:32:10 -0800 (PST) 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=@linaro.org header.s=google header.b=UpL5Z4PG; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727379AbgBERas (ORCPT + 99 others); Wed, 5 Feb 2020 12:30:48 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36542 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbgBERar (ORCPT ); Wed, 5 Feb 2020 12:30:47 -0500 Received: by mail-wr1-f66.google.com with SMTP id z3so3778554wru.3 for ; Wed, 05 Feb 2020 09:30:44 -0800 (PST) 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=BA/wxTBKBRtXyBJptwlCXymjnHMIAT83JNQdcmKZ7GY=; b=UpL5Z4PGv5IbifOCXJmA3EvKU8pwWTuibgFkCYerfZ0RWYMWJsc8jdRFKSdHulhrWW 0q5QFjVXGqO8N3azYMUT6BuQ70iIsYooSH0EN3NCB1U+uAl0UOubOv/x84pOWUnwZOfz nqLUdyrNpbx9UQKrlex68a8wL6FXpMdsVOp2ImierJGNMKjy/XyENBdZuZ87OyOllEPm 3OBBBIUFzK0S2Bmis4vn5z0G3ksW8K0PQM62ik+UqemshCq2wrtaGg6nGM95ryq0m1oV bjtOm73AnLl8o+WYQlLgbQBG72NiEnexJulDQcDQhqCPvLnUWDJPV8Z2q1LLoi5XlXbF 6avg== 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=BA/wxTBKBRtXyBJptwlCXymjnHMIAT83JNQdcmKZ7GY=; b=sJjfdFvgBe8F6iTAO3lslR+o7Ss/IOE8tqOccjhO47CTz2FLM6kL/bEqjJ7CYXF/dK byRluTwndKH7+I4hlo//cMLofjgY/YV1IMCtfdRH0ubIOPRVr3YOOXj2yCccY4axN1ac +kxCcaS87nXROwK1yNpDZzMjXeG/EUCqZSEE3Ql0Qx5P9v4y8saEQUe59f1cA1+RUV/s zw5+Tn+jJNabIA1jJqrCV/dQwW3N3HgEOIN84L6q9ILuNwIaY5i0W40MibisyhLpXd4C Ash+kI9hdxWWwc5mSuDrVhOeK3LjwBOvLjBbRv1Bk29AJ65AnffN+DLzvTQc3c+TU+Pe ra7w== X-Gm-Message-State: APjAAAWhfSBttd9nwEQN0w+TJ3gYmCuUD9wP093+MskmzjOf2isBHh0Y 4Uh+pWyUd8SZsA6RxOTFXaoveQ== X-Received: by 2002:adf:e74a:: with SMTP id c10mr31507302wrn.254.1580923844315; Wed, 05 Feb 2020 09:30:44 -0800 (PST) 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 d13sm651699wrc.3.2020.02.05.09.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 09:30:43 -0800 (PST) Date: Wed, 5 Feb 2020 17:30:42 +0000 From: Daniel Thompson To: Douglas Anderson Cc: Anatoly Pugachev , sparclinux@vger.kernel.org, Jason Wessel , Masahiro Yamada , Chuhong Yuan , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Dan Carpenter Subject: Re: [PATCH] kdb: Fix compiling on architectures w/out DBG_MAX_REG_NUM defined Message-ID: <20200205173042.chqij5i53mncfzar@holly.lan> References: <20200204141219.1.Ief3f3a7edbbd76165901b14813e90381c290786d@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200204141219.1.Ief3f3a7edbbd76165901b14813e90381c290786d@changeid> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 04, 2020 at 02:12:25PM -0800, Douglas Anderson wrote: > In commit bbfceba15f8d ("kdb: Get rid of confusing diag msg from "rd" > if current task has no regs") I tried to clean things up by using "if" > instead of "#ifdef". Turns out we really need "#ifdef" since not all > architectures define some of the structures that the code is referring > to. > > Let's switch to #ifdef again, but at least avoid using it inside of > the function. > > Fixes: bbfceba15f8d ("kdb: Get rid of confusing diag msg from "rd" if current task has no regs") > Reported-by: Anatoly Pugachev > Signed-off-by: Douglas Anderson Thanks for being so quick with this (especially when if I had been less delinquent with linux-next it might have been spotted sooner). > --- > I don't have a sparc64 compiler but I'm pretty sure this should work. > Testing appreciated. I've just add sparc64 into my pre-release testing (although I have had to turn off a bunch of additional compiler warnings in order to do so). > kernel/debug/kdb/kdb_main.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c > index b22292b649c4..c84e61747267 100644 > --- a/kernel/debug/kdb/kdb_main.c > +++ b/kernel/debug/kdb/kdb_main.c > @@ -1833,6 +1833,16 @@ static int kdb_go(int argc, const char **argv) > /* > * kdb_rd - This function implements the 'rd' command. > */ > + > +/* Fallback to Linux showregs() if we don't have DBG_MAX_REG_NUM */ > +#if DBG_MAX_REG_NUM <= 0 > +static int kdb_rd(int argc, const char **argv) > +{ > + if (!kdb_check_regs()) > + kdb_dumpregs(kdb_current_regs); > + return 0; > +} > +#else The original kdb_rd (and kdb_rm which still exists in this file) place the #if inside the function and users > 0 so the common case was covered at the top and the fallback at the bottom. Why change style when re-introducing this code? Daniel.