Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp632480pxb; Mon, 7 Feb 2022 21:32:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyp/FKtejKRIYD0ktwb4IaIl8dXKPiAKqKtqswToY7+aSZZI/QNj38t9vBcgJ8vRgEqkRuO X-Received: by 2002:a17:902:6948:: with SMTP id k8mr3061649plt.136.1644298360644; Mon, 07 Feb 2022 21:32:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644298360; cv=none; d=google.com; s=arc-20160816; b=n8DjRWDoV+I4uFub9hi3vOUVJapCblBuBfT9yM3ms0dCaIGl7b+nx435vXafWqmJ+5 WfaFd4rhNApydImG9yRI3w2Z8A5K4whpZ4iSrY1DBETKJ/sfGiDhizvEFshDNt9chGTq vHAecWcWOpXRwbPMbzITjMzpQGckKfRgYPSwVTscSjTRTHUPWKlxbrF8WZEOvha8ml79 javXj1qtfqMH2t+0D3pshZjalrvqVYbWFNZbWEU/X7SLSIHXR3MtYknESqrdQyfwG1dK u3sbj8WnIViL0lCkPLHpJukuwSqnBcJGrY9PfCDHoBc35K5AhxQZ4SWmYxmdUrxK4I1r uEJQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=L5Y6tZ7R3KyR03w5zcFELc4O16jaupwakXADGje8Tdc=; b=tQUoWyODg4Qmtj2CuQwF6ctmMX1WZyh3e8ewTT+9j8PmuCpfMV7+touN3bMNTbxPGV UYbuy+DJMLUzzyCoD7Uy05j7fLaS6a2noLcQHS8rareohIWlnwWtFpnpn4NUPXXjXvUH efumVCvwAcA4CSyKg7keYck/9sNfkgR1M1Mjq9yHKgNUFM9i45ccPOgYFoCYkDXFgt+U EnT21wK3myU1ZxKjIwVuxbRvvngtvkvI+HxtieY4/jqsJJAXCstMk1lXRQ9FlRFH/H+n qyD65QCWsIJ4ftQqZ5/OkMWf6kIpmZK94HrNFEiWkXDwk6TmzBpJXEwpjQMOhBn0wPTQ ymiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=X2Yr6MGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a64si11882942pge.782.2022.02.07.21.32.26; Mon, 07 Feb 2022 21:32:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=X2Yr6MGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235655AbiBHBIe (ORCPT + 99 others); Mon, 7 Feb 2022 20:08:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbiBHAfQ (ORCPT ); Mon, 7 Feb 2022 19:35:16 -0500 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D48C061355 for ; Mon, 7 Feb 2022 16:35:12 -0800 (PST) Received: by mail-qk1-x731.google.com with SMTP id 13so12458556qkd.13 for ; Mon, 07 Feb 2022 16:35:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=L5Y6tZ7R3KyR03w5zcFELc4O16jaupwakXADGje8Tdc=; b=X2Yr6MGhvVb6PTuHIw5jF9tlHEgzZoalL5ybQEqPTb/qd7/U7yZhENC+0oxeSj8IRB SwlxlJ/mEMpqHyBbYePbI5X0/NH7W2rE4Yd7txmWMcs+UW8cqCkl4qO0YS46t+CuSi3B OsQ0d0lnsRoZ7lDicoRZMdYwG7Q0J1RJVzJdHbGJy8WXRSruie6FPM/aROTdlN0QjwHa hOLT5hWWMFzMBiSY9KHZUKMqhfcM5Z5pIMPg/S9yMZh1rSlJCGPsyK0RfnvKO3NdobrM LcN7iIDBK2ZVe6eGw3hYJgY7QVEt1kLc7Fc4roh3JVgTQHWOiO8+8Qv4iWE5Dz94L7YJ J4tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=L5Y6tZ7R3KyR03w5zcFELc4O16jaupwakXADGje8Tdc=; b=EJZidULqr0GOLuhJX0kPFi5dfChHKNEcjAPmXwzNigKnNuhXSNRSUvubl2XugOVh8E ohcfP+LBo8OJcxMXCWxVbWY8TTY/SIBqVQpHHqcV04Yd0xB2n7QGOrEadUigSY3dPvVU qTZutMRzZP7BHIon5m4CNBQxMVi8gCtWiHlNoctkBDuN4e8kF+d6aH7lqm9IrveMtyjc tmM6XtfjHo0tu0HF0yAPDAXS4bnxOzv+Ssqtr1Jt9q4PFA64otbSFbaE6xPVumDaJTNZ 9KOe+zNEUahYMDe3gvpGNvJsBF4sNgW4KzIH+LmJw5C/afDjj5KmVXgKHrhK5GwNZr6A nyUA== X-Gm-Message-State: AOAM533D7sji328WTblIV/GosEBIeKE8VQi4ZAEEbX1J+Fdz3nhyRvrk pifdqEYOL9vHF5OhHDflKyg= X-Received: by 2002:a05:620a:170e:: with SMTP id az14mr1401831qkb.780.1644280510441; Mon, 07 Feb 2022 16:35:10 -0800 (PST) Received: from mail.google.com ([207.246.89.135]) by smtp.gmail.com with ESMTPSA id b184sm6354942qkf.87.2022.02.07.16.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 16:35:09 -0800 (PST) Date: Tue, 8 Feb 2022 08:35:02 +0800 From: Changbin Du To: Jisheng Zhang Cc: ChangbinCONFIG_IRQSOFF_TRACER Du , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] riscv: fix oops caused by irq on/off tracer Message-ID: <20220208003502.62gi5xhyg6bk2t2h@mail.google.com> References: <20220129004226.32868-1-changbin.du@gmail.com> <20220207123850.l4r5qjswaegwisbx@mail.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 07, 2022 at 11:31:41PM +0800, Jisheng Zhang wrote: > On Mon, Feb 07, 2022 at 08:38:50PM +0800, ChangbinCONFIG_IRQSOFF_TRACER Du wrote: > > On Mon, Feb 07, 2022 at 01:25:03AM +0800, Jisheng Zhang wrote: > > > On Sat, Jan 29, 2022 at 08:42:26AM +0800, Changbin Du wrote: > > > > The trace_hardirqs_on/off requires at least two parent call frames. > > > > If not, the code generated by CALLER_ADDR1 (aka. ftrace_return_address(1)) > > > > could trigger memory access fault. > > > > > > > > [ 0.039615][ T0] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000f8 > > > > [ 0.041925][ T0] Oops [#1] > > > > [ 0.042063][ T0] Modules linked in: > > > > [ 0.042864][ T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.17.0-rc1-00233-g9a20c48d1ed2 #29 > > > > [ 0.043568][ T0] Hardware name: riscv-virtio,qemu (DT) > > > > [ 0.044343][ T0] epc : trace_hardirqs_on+0x56/0xe2 > > > > [ 0.044601][ T0] ra : restore_all+0x12/0x6e > > > > [ 0.044721][ T0] epc : ffffffff80126a5c ra : ffffffff80003b94 sp : ffffffff81403db0 > > > > [ 0.044801][ T0] gp : ffffffff8163acd8 tp : ffffffff81414880 t0 : 0000000000000020 > > > > [ 0.044882][ T0] t1 : 0098968000000000 t2 : 0000000000000000 s0 : ffffffff81403de0 > > > > [ 0.044967][ T0] s1 : 0000000000000000 a0 : 0000000000000001 a1 : 0000000000000100 > > > > [ 0.045046][ T0] a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000 > > > > [ 0.045124][ T0] a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000054494d45 > > > > [ 0.045210][ T0] s2 : ffffffff80003b94 s3 : ffffffff81a8f1b0 s4 : ffffffff80e27b50 > > > > [ 0.045289][ T0] s5 : ffffffff81414880 s6 : ffffffff8160fa00 s7 : 00000000800120e8 > > > > [ 0.045389][ T0] s8 : 0000000080013100 s9 : 000000000000007f s10: 0000000000000000 > > > > [ 0.045474][ T0] s11: 0000000000000000 t3 : 7fffffffffffffff t4 : 0000000000000000 > > > > [ 0.045548][ T0] t5 : 0000000000000000 t6 : ffffffff814aa368 > > > > [ 0.045620][ T0] status: 0000000200000100 badaddr: 00000000000000f8 cause: 000000000000000d > > > > [ 0.046402][ T0] [] restore_all+0x12/0x6e > > > > > > > > > > Hi Changbin, > > > > > > Could you please provide the reproduce steps? It looks a bit > > > interesting. > > > > > Just enable CONFIG_IRQSOFF_TRACER and rebuild kernel with llvm. Then boot the > > new kernel. > > Thanks for the information. I tried IRQSOFF_TRACER with gcc+binutils, > can't reproduce the issue. I forget to try clang+llvm. From another side > The fact that gcc+bintuils can't reproduce it means this is a clang+llvm > speicial case, no? The behaviour of GCC is a bit different, please refer to another disccusion: https://lore.kernel.org/lkml/C2470F2D-9E45-49D7-A03B-E6A7BB4B9738@jrtc27.com/T/ But I suppose it still has similar issue. Make sure FRAME_POINTER is enabled also. -- Cheers, Changbin Du