Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp663839yba; Wed, 3 Apr 2019 17:04:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8gRAQYcdSKjlYUv8fth1i7V2IXskv/S5KtV9KI8Yz+4Zkhv/pXF7YJP6b7VIKCYx92umu X-Received: by 2002:a17:902:ba8b:: with SMTP id k11mr3123465pls.40.1554336286612; Wed, 03 Apr 2019 17:04:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554336286; cv=none; d=google.com; s=arc-20160816; b=uNNR/WzPXbvTHuJVGOo28CPzdAIJH0TmQMypq/r9ff6bvDo5/sIxWtcUjHbYQ5AkY3 v6gAqjTOGFeBzWYrdS7jFrjGlaLmw850Ytnb5VPPTIVxkt9H/OUZ5DIcCK6k9S2X9vEH j9w5dxXc4Dd+/lb92oLcGxi1mk4/SPnB+0ZQblTMo2GZVJ4sHJ5RUUGUfLjlvglc682F CsMSzWc6oOJblKuUt/VqQOQ7VBPwZgdm00bPRkKAhE+T+EVJTD053J8bpm44kbik78rP qxjWL+hyCc04m6SwAPwODmzdPUpm5Xx+brKKFaxZPVcD7QbgyKLGsW0PDbu1cODbD2hK KtPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NXC5ooxTdKml86bHs8j5YPxxa6kGJG8+XGBdoqLTBmY=; b=Z5C5T3Voc7Eih5Bno8n8L/aexh40ZfoZl6arMhnTCKg5mgOCBcfJ3Nql2HSlP+Sj64 Dw78gX1gcQiSDGVE9YxO3czddhA3GinYlepCBA40JepzBGxd513+X9/ZEjFtV+9D47VB FiLOup1uyp8D+XUA98JxDy1z5IcjjFI67lo097mtTDCbKHFidcCuo9XEuNVUwPV7xC/n 37B5N/P7Vb2l13sdfkT1BfZbtirvUNOVErtmRjYCyy5zPBD0pAxhovJvdlYPim2KOhm6 JWZ9ZezDHItw3KLnLrkJWsek+/msPd5Wioq2pwZrRXVY4lDDkhximqDyUcHdV7OXIIX9 s52A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dNX3x4ve; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si14725774pgq.72.2019.04.03.17.04.31; Wed, 03 Apr 2019 17:04:46 -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=@kernel.org header.s=default header.b=dNX3x4ve; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726544AbfDDADc (ORCPT + 99 others); Wed, 3 Apr 2019 20:03:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:36144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbfDDADc (ORCPT ); Wed, 3 Apr 2019 20:03:32 -0400 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FB582133D for ; Thu, 4 Apr 2019 00:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554336211; bh=IQwt+447qV5imO/UOH2jhGSMtL5tPnWfpXrss+nzitA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dNX3x4venusSc1fwvH2YF6qQfqJH9dsBL69VGyQmb/zqdGJdIe6MDsw7zUIYs5mvL yjHy4Pc+GPfgobYxtEEMIBxhQ9IdYOjX9coMZPHaBxITO1dG5iycTu6BY1iaLfmW2F t4CSWdBrLEIEAyg7axxJDGHiP4HUV+hu11nKPO7s= Received: by mail-wm1-f41.google.com with SMTP id v14so931820wmf.2 for ; Wed, 03 Apr 2019 17:03:31 -0700 (PDT) X-Gm-Message-State: APjAAAUKUMmLMHVy7Z9CB+bRJAVUi7r9Uj4TcbVjieCf+22wuA7OPQz4 CL87vKFIS5+dv10l3NunzSUFvEgIRwEMmB6l2Zp4qA== X-Received: by 2002:a1c:6c04:: with SMTP id h4mr1807935wmc.135.1554336210047; Wed, 03 Apr 2019 17:03:30 -0700 (PDT) MIME-Version: 1.0 References: <20190331214020.836098943@linutronix.de> <20190331215136.039902969@linutronix.de> <20190402154329.scp7i7uqevubgwrz@treble> <7789E14E-C623-4DB7-B076-76B931957C9C@amacapital.net> <6205D576-694A-4C7D-B1B7-A9FF2E1F9E77@amacapital.net> In-Reply-To: From: Andy Lutomirski Date: Wed, 3 Apr 2019 17:03:18 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack() To: Thomas Gleixner Cc: Josh Poimboeuf , LKML , X86 ML , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 3, 2019 at 12:42 PM Thomas Gleixner wrote: > > On Wed, 3 Apr 2019, Thomas Gleixner wrote: > > On Tue, 2 Apr 2019, Andy Lutomirski wrote: > > > > On Apr 2, 2019, at 1:29 PM, Thomas Gleixner wr= ote: > > > >>> How about a much better fix: make the DB stack be the same size a= s all > > > >>> the others and just have 4 of them (DB0, DB1, DB2, and DB3. Afte= r all, > > > >>> overflowing from one debug stack into another is just as much of = a bug as > > > >>> overflowing into a different IST stack. > > > >> > > > >> That makes sense. > > > > > > > > Except that we just have two not four. > > > > > > > > It needs some tweaking of the ist_shift stuff in entry_64.S but tha= t's not > > > > rocket science. Famous last words.... > > > > > > > > > > The ist_shift mess should probably be in C, but that=E2=80=99s a big = can of > > > worms. That being said, why do we have it at all? Once upon a time, = we=E2=80=99d > > > do ICEBP from user mode (or a legit breakpoint), then send a signal a= nd > > > hit a data breakpoint, and we=E2=80=99d recurse. But we don=E2=80=99= t run user debug > > > handlers on the IST stack at all anymore. > > > > > > Maybe we can convince ourselves it=E2=80=99s safe? > > > > Maybe. Need to think about it for a while. > > What about kprobes. It has nasty reentrancy stuff as well... > Hmm. We used to have #BP on the same stack, and I bet there were plenty of ways to get #DB and #BP inside each other. I bet the best solution is to set dr7 to 0 before we do anything complicated in do_debug() (at least if we got there from kernel mode). But we should probably make this a whole separate project after your series is done.