Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp258650yba; Wed, 3 Apr 2019 08:14:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEuY+np7JE2VZ86I4JR0NSJRJLNwqrvzQrT5lQ9TizsfxuRpgs+hXWtZSpd7Bvk90s11kk X-Received: by 2002:a62:14c3:: with SMTP id 186mr76131184pfu.21.1554304478053; Wed, 03 Apr 2019 08:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554304478; cv=none; d=google.com; s=arc-20160816; b=TpxqAphcqRH2/YnjFhZVWL8xxcFFBlJwRYQWrQbaJQcZh+0k0cLRh+7jzfxjbjUlIb egocukwLDOfsaaiKY9/+Im6NePsw6lnktNZyP06x/PTAyMZKBQ/rIkfPyjHweoTRRLJn I+mrzeq9QA91FG1E5M8G7kbrzCTI6Qyjz7LMaMxPmwyrE1i3qz6tqatoXdN1QMtb6OQO 6bdpCQQL90zZJK96w4CNNhI/HlK5fwOyyy/9v23NsbZxhSl6ocvVnAUm971QAFk+y6RD 5TAX9nVLlBVcS3dMqoK4YLtN/Mwpqjvfhb0NqrDvvGTI+1tTVJ2tkKdyb4ge1vZOE12H bi2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vEcUGXJBC266thkbGwpyqspGRwCtZE4yg3KRShNDsNw=; b=v2ZMl1vOGyEy/61k8V1wP+xCrNAp4uDcl+DWiSjEdeznCmtmIsHxPoXtkNJp2bOJBn wxKKV+tXmK35B/iwUk5o3n+ixBzYCg7X1pYTmXeEE9v5KRFR0iBxlwisRdLsCN++Zf+N R4yoA7lsUzLCzneNO6vEIBJ/yJCkPrCjCrcirfGhohPVzjIcyNSjHg5KBXiJsntXAL0O ixVG/3M3Vrjebp+1Az8OpfVeFvcdaK1CQWuFKsAEnq7muJgJTq9E+2OyfZTmygktFVCj Ukf7s7SqR4dm7r6KVthtsqXd0g1gTKrSzNNACzfnqH5v6tuUuhK+mxT7I1lubqd9JGyR VcWQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i27si12050849pgl.305.2019.04.03.08.14.22; Wed, 03 Apr 2019 08:14:38 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbfDCPMB (ORCPT + 99 others); Wed, 3 Apr 2019 11:12:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53600 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbfDCPMA (ORCPT ); Wed, 3 Apr 2019 11:12:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F87320265; Wed, 3 Apr 2019 15:12:00 +0000 (UTC) Received: from treble (ovpn-123-180.rdu2.redhat.com [10.10.123.180]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE6F2608A5; Wed, 3 Apr 2019 15:11:59 +0000 (UTC) Date: Wed, 3 Apr 2019 10:11:57 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: Thomas Gleixner , LKML , x86@kernel.org, Andy Lutomirski Subject: Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack() Message-ID: <20190403151157.dcjmunsl7mna4ore@treble> References: <20190331214020.836098943@linutronix.de> <20190331215136.039902969@linutronix.de> <20190402154329.scp7i7uqevubgwrz@treble> <20190402155149.c23ivzzc5hyykokl@treble> <20190403080828.GN12232@hirez.programming.kicks-ass.net> <20190403081041.GB14281@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190403081041.GB14281@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 03 Apr 2019 15:12:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 03, 2019 at 10:10:41AM +0200, Peter Zijlstra wrote: > On Wed, Apr 03, 2019 at 10:08:28AM +0200, Peter Zijlstra wrote: > > On Tue, Apr 02, 2019 at 10:51:49AM -0500, Josh Poimboeuf wrote: > > > On Tue, Apr 02, 2019 at 05:48:56PM +0200, Thomas Gleixner wrote: > > > > > With the above "(stk <= begin || stk >= end)" check, removing the loop > > > > > becomes not all that important since exception stack dumps are quite > > > > > rare and not performance sensitive. With all the macros this code > > > > > becomes a little more obtuse, so I'm not sure whether removal of the > > > > > loop is a net positive. > > > > > > > > What about perf? It's NMI context and probably starts from there. Peter? > > > > > > I believe perf unwinds starting from the regs from the context which was > > > interrupted by the NMI. > > > > Aah, indeed. So then we only see exception stacks when the NMI lands in > > an exception, which is, as you say, quite rare. > > Aah, ftrace OTOH might still trigger this lots. When you do function > tracer with stacktrace enabled it'll do unwinds _everywhere_. Even then, ftrace stacktrace will be really slow regardless, and this loop removal would be a tiny performance improvement for a tiny fraction of those stack traces. Unless the improvement is measurable I would personally rather err on the side of code readability. -- Josh