Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp596589yba; Thu, 18 Apr 2019 06:34:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvc//a+9rkbS+Lnj/Qioy5B6a4P/jHP6Cjh8RJVum0mGln0yWtjU4M5yXyqgihkUd0MSYo X-Received: by 2002:a17:902:54c:: with SMTP id 70mr63461970plf.210.1555594474308; Thu, 18 Apr 2019 06:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555594474; cv=none; d=google.com; s=arc-20160816; b=qttXkxHET+xndCs2V5XI/8hibaAxZsNsBGsJy84xwO/C2bne2PINEVhK/j/IujmF8X Y/Mr7ykx2ZgcBchmFQ4bntnEp+jL7wAR28QaqWi7aR3W3k+eieb2SYhEnJ2uQoS3+WGZ g00NT6fzeAWAs2HRxPxRR9T9fNLdp+b8qEpBIvVWdbHNMbRn6OYiZUJbFfHVgdviHyCX +qnhuNWE5B9w9yzCR70zbn7YktqERfcLyFNfQU7wlaK16NeFswQMx0AXiLY2SAwxbv7J JWBo6h+NvgeO4F58M7OCX1BJDLTcHIC62c9qKQg+fY7CR7c/2WGd/doH8pwYsG5mNqpQ 1bRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=y3PXhLtNUtfy8g0a1vUfshuhGXPYHwQKkE/mVrJEBZI=; b=onte8zBxwYfgOqFZQpCi/PafqtlZxcIEanHM9jgAm0SvqptWoxhQe9PGZ5UBW66Mpq nN5PYiXgLLSkmv7oh9VjTJZQUq1wrbjtZ23FX6xtpBrByCPGo+oHT6amndMg+Z+E7O5f BrzsUYY9RbnSeHyzLtOgMxwCx57kfwonFLrUqGtT8KImrkcD5zPRR1KV+KgCIbuI0QI6 mDxV96mG+vWqitnANxota4wIMIi07M7sQy/OuaqTC8oEWiPcNQbu4hcyfl1MXGZFxXD2 klRPhzTwCwUWDGS3lrh1+zrFichbjxN58Su+3wbhnhMfEYwknITVYlRaK04NxQf0p3zk icmg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si2117415plr.247.2019.04.18.06.34.18; Thu, 18 Apr 2019 06:34:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388842AbfDRLyG (ORCPT + 99 others); Thu, 18 Apr 2019 07:54:06 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:35705 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727807AbfDRLyG (ORCPT ); Thu, 18 Apr 2019 07:54:06 -0400 Received: from pd9ef12d2.dip0.t-ipconnect.de ([217.239.18.210] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hH5bc-000615-N4; Thu, 18 Apr 2019 13:53:28 +0200 Date: Thu, 18 Apr 2019 13:53:26 +0200 (CEST) From: Thomas Gleixner To: Andrey Ryabinin cc: LKML , Josh Poimboeuf , x86@kernel.org, Andy Lutomirski , Steven Rostedt , Alexander Potapenko , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-mm@kvack.org, Alexey Dobriyan , Andrew Morton , Pekka Enberg , David Rientjes , Christoph Lameter , Catalin Marinas , Mike Rapoport , Akinobu Mita , iommu@lists.linux-foundation.org, Robin Murphy , Christoph Hellwig , Marek Szyprowski , Johannes Thumshirn , David Sterba , Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org, dm-devel@redhat.com, Mike Snitzer , Alasdair Kergon , intel-gfx@lists.freedesktop.org, Joonas Lahtinen , Maarten Lankhorst , dri-devel@lists.freedesktop.org, David Airlie , Jani Nikula , Daniel Vetter , Rodrigo Vivi , linux-arch@vger.kernel.org Subject: Re: [patch V2 09/29] mm/kasan: Simplify stacktrace handling In-Reply-To: <5b77992a-52b6-807e-f77d-9cf3e648c71f@virtuozzo.com> Message-ID: References: <20190418084119.056416939@linutronix.de> <20190418084253.903603121@linutronix.de> <5b77992a-52b6-807e-f77d-9cf3e648c71f@virtuozzo.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Apr 2019, Andrey Ryabinin wrote: > On 4/18/19 11:41 AM, Thomas Gleixner wrote: > > Replace the indirection through struct stack_trace by using the storage > > array based interfaces. > > > > Signed-off-by: Thomas Gleixner > > Acked-by: Dmitry Vyukov > > Cc: Andrey Ryabinin > > Cc: Alexander Potapenko > > Cc: kasan-dev@googlegroups.com > > Cc: linux-mm@kvack.org > > Acked-by: Andrey Ryabinin > > > > > static inline depot_stack_handle_t save_stack(gfp_t flags) > > { > > unsigned long entries[KASAN_STACK_DEPTH]; > > - struct stack_trace trace = { > > - .nr_entries = 0, > > - .entries = entries, > > - .max_entries = KASAN_STACK_DEPTH, > > - .skip = 0 > > - }; > > + unsigned int nr_entries; > > > > - save_stack_trace(&trace); > > - filter_irq_stacks(&trace); > > - > > - return depot_save_stack(&trace, flags); > > + nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 0); > > + nr_entries = filter_irq_stacks(entries, nr_entries); > > + return stack_depot_save(entries, nr_entries, flags); > > Suggestion for further improvement: > > stack_trace_save() shouldn't unwind beyond irq entry point so we wouldn't > need filter_irq_stacks(). Probably all call sites doesn't care about > random stack above irq entry point, so it doesn't make sense to spend > resources on unwinding non-irq stack from interrupt first an filtering > out it later. There are users which care about the full trace. Once we have cleaned up the whole architeture side, we can add core side filtering which allows to 1) replace the 'skip number of entries at the beginning 2) stop the trace when it reaches a certain point Right now, I don't want to change any of this until the whole mess is consolidated. Thanks, tglx