Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp1030394lqp; Thu, 23 May 2024 07:14:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmC3c9NJlXyWmeD+3jDWPFN+f0YM/cV+8aHJkQzjBPoMK6Tr2NPGgwsI9NMf+4lhJAzNLraEROFZAm7UGrM7PiQOo/yPL2YvzdQHo+Iw== X-Google-Smtp-Source: AGHT+IEGtX91xGdkefJ8u5wfw3EO5F55+NvAUzTeDS+Tmf93Ar8cbWGl5XtMjrWFDyWRWZ0A/avK X-Received: by 2002:a17:903:11d1:b0:1f3:b55:e247 with SMTP id d9443c01a7336-1f31c9e4a78mr51932415ad.55.1716473640531; Thu, 23 May 2024 07:14:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716473640; cv=pass; d=google.com; s=arc-20160816; b=h8rTdUqiyc1R8J15HYv8gAcqB3mW556p5qWeCmOm+uzt2gqtN0npVxfP4i/HzWlP2w rdp94R5ueRNwHkICaYpDUuYOIAydzpNFjXT9p6uDCbaSOLv5l0ipxv2AqGj21YU7AQpT k5KxGLCxNpXASpqfGsiFu/CS2+rP3cBr48ED1DjPGqk2EuPHRpdbU84LMkq30omtixng Xeqp1ywX7jaRscv9p57/ijFaKo49y1fku4uL2Kwqh67GgYvYVXNStZdylnanvU7qLWb0 afj5g1CUuXTRkhieTlNnvEppOF+oaYssPBzgK2FgRbQuVjW90HPViHO9BjZSxFI0Ncu8 3eQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wHmf0+7f1PdiR6STtU5I6IdOk8lZ3B3cslxc5ZQ4saA=; fh=t+K7UHPZy4KON2Xo1KRwCsztY5eKOnAAP56T46pLyVM=; b=IrN5fRkGIIoUQu+idlW58pvNH2mDh91QL15xY2T0Z6YzRrZ0F2ODmNeUmL0JfPpkiQ fCqTpcFi1ZBh2JCzznoeHN5t4ZZ6RvMfJwjG5uKD5QF8wEmU+UxNQGdj1eRfRoVirI2d /k/7QGDFJVEmpjJkrExubQSH00yTPIFLArs/YxC82IhR1+Kauv/50GdvLN4aVX5Qy92c 5bOAtWD3lM4EDDWCT/tUeRImtcaOrUcRJ8JYk1BgRbEwyP1UzBMU0tTePJLKgc8IFFnK pYqzbWB1Epg82AEG4pMPIwx+Z4WNJT1ahSldEvQ7J6STs7tKGiAaWAjRrmXb8RycSRLI p4dA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pG3FZUZc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-187623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c15e33csi53716395ad.529.2024.05.23.07.14.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 07:14:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pG3FZUZc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-187623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A2DA2841BE for ; Thu, 23 May 2024 14:13:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A57314B098; Thu, 23 May 2024 14:13:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pG3FZUZc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A9FA13C68A; Thu, 23 May 2024 14:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716473635; cv=none; b=kAbxvXKtpTP8wH5liEfJQY10wL9ENg5fv8Gb6xsrQ8N1ZFp84R7ASj+O4NyMWZoM2NXgtvh6SCcN8UjIp40ANXylazjPEQsH15AY1bKVtqwLflVdjaCCfxXOkwsARu86csbLDDN3mBlnABZjxmsBgHCBnaHn2NGlhO8hLwKMh8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716473635; c=relaxed/simple; bh=wHmf0+7f1PdiR6STtU5I6IdOk8lZ3B3cslxc5ZQ4saA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FvsIzqGUZJNP5A1LapgeiReH5vl3PtByHfeRM9CaHGyA4Xit1gtBCD694Bpg4ggPkfzz+yjpTHNdvtGUXhAMvffLAtJi/cvtyPDT4soYbzVgZeHRJ10tdH9gFPg8KKRfDd9Mi8G2Vo3yifMX1kv6i0MeXUDeqCoxgO6b3ZA5PdQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pG3FZUZc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ADDFC32786; Thu, 23 May 2024 14:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716473634; bh=wHmf0+7f1PdiR6STtU5I6IdOk8lZ3B3cslxc5ZQ4saA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pG3FZUZcHCWWmWQj87cDsg9x+aCOqkZg0AY/fdChUJM8p14lzvEzizpRKuHjSb8v1 mr+V8Ar+hMyMvXJziq18S8UPfLVnpcIvZsWW5T2uP27KPi1k4NhK+fm21bFRgmpwvD iKz3+ZbnSCTKVeisPwev02H1OBWy6vHmdlNXoxLIl+J1DkliIbkDmsFJZc8/ZFIBTr AnnjzBUEoeE7dGoU2XYLpqbf35+nxElqLJKaNgpqgJcOJNivCrs03H5PQG0dpt3qJq C7SS8H0HmRti2jEqD+pEBRyNA77lNi3BCtjTnSsHnD1HiI3y9UAyLNSt8J6chiHXne cETsF6OVa7ZmQ== Date: Thu, 23 May 2024 15:13:50 +0100 From: Conor Dooley To: Alexandre Ghiti Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Steven Rostedt , Masami Hiramatsu , Mark Rutland , Andrea Parri , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Conor Dooley , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: Fix early ftrace nop patching Message-ID: <20240523-showcase-helpful-4cc84fe2f1d5@spud> References: <20240523115134.70380-1-alexghiti@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2HITYodwdCyzzdtT" Content-Disposition: inline In-Reply-To: <20240523115134.70380-1-alexghiti@rivosinc.com> --2HITYodwdCyzzdtT Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 23, 2024 at 01:51:34PM +0200, Alexandre Ghiti wrote: > Commit c97bf629963e ("riscv: Fix text patching when IPI are used") > converted ftrace_make_nop() to use patch_insn_write() which does not > emit any icache flush relying entirely on __ftrace_modify_code() to do > that. >=20 > But we missed that ftrace_make_nop() was called very early directly when > converting mcount calls into nops (actually on riscv it converts 2B nops > emitted by the compiler into 4B nops). >=20 > This caused crashes on multiple HW as reported by Conor and Bj=F6rn since > the booting core could have half-patched instructions in its icache > which would trigger an illegal instruction trap: fix this by emitting a > local flush icache when early patching nops. >=20 > Fixes: c97bf629963e ("riscv: Fix text patching when IPI are used") > Signed-off-by: Alexandre Ghiti Reported-by: Conor Dooley Tested-by: Conor Dooley Thanks for the quick fix Alex :) --2HITYodwdCyzzdtT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZk9PHQAKCRB4tDGHoIJi 0qjYAQCZbnkVecKQA29bgEC+XPR/AW8H6mGRAzkYf8O1XZA2AQEAoILUgAjaGIaK gWxhQLnUJzhG8w4SK9oCaJ0aLEtWgAI= =2ZE4 -----END PGP SIGNATURE----- --2HITYodwdCyzzdtT--