Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp277919pxb; Mon, 13 Sep 2021 19:12:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqk0anG3jYAXSYxQqXoDjiW73ZWmJJl0B9VToJ9JeJ/v0TXDunkoXuakG6zpCc9Bv2aoXx X-Received: by 2002:a50:9b06:: with SMTP id o6mr16652581edi.284.1631585572119; Mon, 13 Sep 2021 19:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631585572; cv=none; d=google.com; s=arc-20160816; b=bOw4gfkdxphgiFKijKTfJ3TP6ri2OSZGeHeRToQk6UVrZ/Q3bPhYcYNCmLddLyZYzY xos3hCDMayGgjDCcRdYCdZbubnSAMjxK+OibwMl04xnXMdX1pMeYlgKjYPQDEyehBTMe SZziU2gXlta0vFbgjbzeDFFSJUSCjbEco0Ul9pJhTX0WEJsuaNjUv7d52ZvUzbgYejtZ obC9ZADwpwVaPBcIb7jKLDpEP9HkcR+VhKm52eBHucTiQZi0hz/pkx88EceH7le2xB9b CYdtBLg3IFDoVAWfo9C2zmBE6vhOrOOCSfIqpnn8HdbU22JfWNuzJWTLH1+O/VivgY9Z 7Efg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=X8TZI6Llai2EE3tAL/eDLAyTDrbcVoTT3DWK3d13i1Y=; b=fBtrjuPMMCask3E/z/h+N+2dKlEiQXo1yzJJr3V4Lzfn6DHt1/1O7ReTDt62UUbHns RIs6D/95wpP8VkVYrRflvd9B+kDRzmF3Zef6foUrRjLSNtkc+n96c3m/j6ueCPxNw0uB AKeA61YktpsmPgKtuBvMWDbd6jU5RSfuX3Vj6kPeM7gB8gNZp42klaWvYhJ7m/zBcMa8 +wuhsD/SNacMEpblH8+uhfUgEkKdgyIXkxsrUQrXD/dndvvd6wnHA59UKSJDy72fEPvY bIVg6/5aXBJ2AX4wBnaETWnVYRFWnkspDJor7yFzCpT0VWjQf6n5xLjQzteUmNSdcn5U vLxw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca15si8734401edb.208.2021.09.13.19.12.27; Mon, 13 Sep 2021 19:12:52 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236896AbhINCKK (ORCPT + 99 others); Mon, 13 Sep 2021 22:10:10 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:37336 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233111AbhINCKG (ORCPT ); Mon, 13 Sep 2021 22:10:06 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0UoK3s4Y_1631585325; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0UoK3s4Y_1631585325) by smtp.aliyun-inc.com(127.0.0.1); Tue, 14 Sep 2021 10:08:46 +0800 Subject: Re: [PATCH] perf: fix panic by disable ftrace on fault.c To: Dave Hansen , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "open list:X86 MM" , "open list:BPF (Safe dynamic programs and tools)" , "open list:BPF (Safe dynamic programs and tools)" References: From: =?UTF-8?B?546L6LSH?= Message-ID: <1e7a75ab-aa9e-1532-2746-28bfcbc98908@linux.alibaba.com> Date: Tue, 14 Sep 2021 10:08:45 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/13 δΈ‹εˆ10:49, Dave Hansen wrote: > On 9/12/21 8:30 PM, ηŽ‹θ΄‡ wrote: >> According to the trace we know the story is like this, the NMI >> triggered perf IRQ throttling and call perf_log_throttle(), >> which triggered the swevent overflow, and the overflow process >> do perf_callchain_user() which triggered a user PF, and the PF >> process triggered perf ftrace which finally lead into a suspected >> stack overflow. >> >> This patch disable ftrace on fault.c, which help to avoid the panic. > ... >> +# Disable ftrace to avoid stack overflow. >> +CFLAGS_REMOVE_fault.o = $(CC_FLAGS_FTRACE) > > Was this observed on a mainline kernel? Yes, it is trigger on linux-next. > > How reproducible is this? > > I suspect we're going into do_user_addr_fault(), then falling in here: > >> if (unlikely(faulthandler_disabled() || !mm)) { >> bad_area_nosemaphore(regs, error_code, address); >> return; >> } > Correct, perf_callchain_user() disabled PF which lead into here. > Then something double faults in perf_swevent_get_recursion_context(). > But, you snipped all of the register dump out so I can't quite see > what's going on and what might have caused *that* fault. But, in my > kernel perf_swevent_get_recursion_context+0x0/0x70 is: > > mov $0x27d00,%rdx > > which is rather unlikely to fault. Would you like to check the full trace I just sent see if we can get any clue? > > Either way, we don't want to keep ftrace out of fault.c. This patch is > just a hack, and doesn't really try to fix the underlying problem. This > situation *should* be handled today. There's code there to handle it. > > Something else really funky is going on. Do you think stack overflow is possible in this case? To be mentioned the NMI arrive in very high frequency, and reduce perf_event_max_sample_rate to a low value can also avoid the panic. Regards, Michael Wang >