Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1566588pxb; Fri, 10 Sep 2021 08:40:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWcHpw/f/XMAy5y8RHUDM1iTidIMygR3/f+8svmGZyrGsqfsjVUZN2vfhuLn1ie+nkuhfS X-Received: by 2002:a02:b092:: with SMTP id v18mr5062377jah.51.1631288437077; Fri, 10 Sep 2021 08:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631288437; cv=none; d=google.com; s=arc-20160816; b=Ear6kYYrxAFFqV9qS9SxOlTu1iOKcd5GBaQGFoq7sqMP9S9h4bTPPjSNwXNAIlMXbt 2f2p6QT4dZRfl/GZ4TvVTeXul/zd/3/5kEp//sslOl3F9TtrEP6L9Hdzn5MauakdePXU VtTgTuJ3hKdWGJy+N6PeDFMepcG4o0pvGNK6w17cheQjjqu9GmwpF2CAYLcBcBqjDIPr d9TmkIZeARph/kDEf4R3JU8/0+MZlBQu8Ltn7htohdHUzhpkPuK3tYl1pXLEBHMnO/dQ O8zgGDo/8/2Q+B0F/MTXg319AMc7xEB15Iv6y2FFrLg0zTaT+AvsNFWN5IZzn9RlfzR4 SQyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=beG8h/qzme+fTyiQhIuWR7Lf7uWlwUHjpcQJDRpcyHY=; b=X5yeHac6Wf6t3jrcMY8iLlZ8y2A1f3gepXFxdTI53/nIDlbuGr/n+bDw9u9myYcb8Y 5sIbO1eHsZCEi3A8JcVkPjTG9uA/g//yRslKyKdbzr8X/bYpwnDBdB101qGYqPWyXs2W enKOkmc5GGXfnoNdWkQHQYn6XWSiUH5NLXSBv2EbK7/u2CJ9ZsIOPWm5B+eRVklDudOY +B+8tNXvKwTmjysi8yL5NFUceGIJOT/EXtjfFSdqucMpIjO/eybamGeNpwsFqpmDtdzI fVPhOVMBy+5Y83hB0iWxUbsSE0O/+FP+zTEQIQNRjGh0zPTZfCijSXQODEmF+sKpCGKf TT6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=RzOxiElj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si5218186jaf.0.2021.09.10.08.40.24; Fri, 10 Sep 2021 08:40:37 -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=@infradead.org header.s=desiato.20200630 header.b=RzOxiElj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234574AbhIJPkT (ORCPT + 99 others); Fri, 10 Sep 2021 11:40:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234604AbhIJPkP (ORCPT ); Fri, 10 Sep 2021 11:40:15 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26DDDC0613C1; Fri, 10 Sep 2021 08:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=beG8h/qzme+fTyiQhIuWR7Lf7uWlwUHjpcQJDRpcyHY=; b=RzOxiElj7RvGJsvpuwvBFOJxSH JvA723cw93ZhYz4BqLFZ5UiChcpd3271tdgSuwoIHjgjVQac3h0sX9KKijsN3andNdq3r3OKBuWni mQoUnbC2CkaUxu2RPKi/KfVvQ3JDNnvIlM3fadP1QGXjtHr3zKvqVzh6B51v3wc1m2l/gBjPyzqXK eSpXkntybGl0vmDeU7iQjRyRs0hPpKGio2D7vb0Ib5kGimJvSAgr8A6R0XnLe+BY4y0yz/kXHjgtW /DyW6KJpTaEHYFMHXMX5jHhgBdNtDKnKqodXfWo7bHCUreEo29yTheeMuJgsgvv1EBTQoAlQKvRQ2 x0EOtq0A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOibw-002AHo-S3; Fri, 10 Sep 2021 15:38:41 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id DBA9F98627A; Fri, 10 Sep 2021 17:38:39 +0200 (CEST) Date: Fri, 10 Sep 2021 17:38:39 +0200 From: Peter Zijlstra To: =?utf-8?B?546L6LSH?= Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "open list:PERFORMANCE EVENTS SUBSYSTEM" , "open list:PERFORMANCE EVENTS SUBSYSTEM" , "open list:BPF (Safe dynamic programs and tools)" , "open list:BPF (Safe dynamic programs and tools)" Subject: Re: [RFC PATCH] perf: fix panic by mark recursion inside perf_log_throttle Message-ID: <20210910153839.GH4323@worktop.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 09, 2021 at 11:13:21AM +0800, 王贇 wrote: > When running with ftrace function enabled, we observed panic > as below: > > traps: PANIC: double fault, error_code: 0x0 > [snip] > RIP: 0010:perf_swevent_get_recursion_context+0x0/0x70 > [snip] > Call Trace: > > perf_trace_buf_alloc+0x26/0xd0 > perf_ftrace_function_call+0x18f/0x2e0 > kernelmode_fixup_or_oops+0x5/0x120 > __bad_area_nosemaphore+0x1b8/0x280 > do_user_addr_fault+0x410/0x920 > exc_page_fault+0x92/0x300 > asm_exc_page_fault+0x1e/0x30 > RIP: 0010:__get_user_nocheck_8+0x6/0x13 > perf_callchain_user+0x266/0x2f0 > get_perf_callchain+0x194/0x210 > perf_callchain+0xa3/0xc0 > perf_prepare_sample+0xa5/0xa60 > perf_event_output_forward+0x7b/0x1b0 > __perf_event_overflow+0x67/0x120 > perf_swevent_overflow+0xcb/0x110 > perf_swevent_event+0xb0/0xf0 > perf_tp_event+0x292/0x410 > perf_trace_run_bpf_submit+0x87/0xc0 > perf_trace_lock_acquire+0x12b/0x170 > lock_acquire+0x1bf/0x2e0 > perf_output_begin+0x70/0x4b0 > perf_log_throttle+0xe2/0x1a0 > perf_event_nmi_handler+0x30/0x50 > nmi_handle+0xba/0x2a0 > default_do_nmi+0x45/0xf0 > exc_nmi+0x155/0x170 > end_repeat_nmi+0x16/0x55 kernel/events/Makefile has: ifdef CONFIG_FUNCTION_TRACER CFLAGS_REMOVE_core.o = $(CC_FLAGS_FTRACE) endif Which, afaict, should avoid the above, no?