From patchwork Wed Feb 28 17:51:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 21099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3508172dyb; Wed, 28 Feb 2024 09:52:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW0yacEUOAYiBYXdRdCZ2UboqSIBy9g6URQaPEA4Wi0OvN+twKgI2PK70TD0tcEpP6d/GtlGtXX+pKjJzKFWnFxZAeZ9A== X-Google-Smtp-Source: AGHT+IFBI9sHF5ZsiLrTKvf6/lbJxB8npVpYO9+dSE/6oPCRbSgVbI0my0j/s7kZm+CegZovNFj9 X-Received: by 2002:a17:906:344a:b0:a43:f825:ef52 with SMTP id d10-20020a170906344a00b00a43f825ef52mr305062ejb.28.1709142771720; Wed, 28 Feb 2024 09:52:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709142771; cv=pass; d=google.com; s=arc-20160816; b=qbczhVfLUsGNAkM9INTFjvyvbUBTKa22CD8Q0aygjIVvc0N+iWRdRu/cF2yv+1DFed PQLeLJVFi5MoeKV9T9dLkOB3czKPz3lOIQFAUmqa/go3oHel9/qapPcgdtHtpNTJZv9E ItXLEM0ZYB+SGqqJsoPu8xfGp/1UrhfJI4+dyhV6G3rMb9EDrFrvGuRVEbQ3Pvk+nvxL 0iAp6822crQd8Wmw8TNUWRkjvcra6Elv0hhTMiL/6usN8DmeJpHG3fGSX5KA7auP92cY TBMxJJNzzzk1MPcjoOCBRZk7/EK+VxPk27nKNp8wRL5qcPbBILwJ5X+FDTzy2k0Obt7H 1Fcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=2PXWhKeObjvrv5a0sp4dojdugZSvAvimHcwo4W++JCk=; fh=hiK2yXzJvCiQhq52BuphGylztvI4viH57MdncFraua4=; b=eyklxbd0dtvfdYT/DsswULyhtGQLjbpZGzz1kme09GiTZF4lcuYnMyW5Zw0fmx5OiN ESwQGCPYa5co1eLqL0o7jANqxOdaDf+M0chgW5yfJC+n0+595HXJy7XetF09IE/cH5CM ZsvUtT+uo28ZeJH969GtZLez0TaAppzNVez7OkmsQI0OUId20CG2YSgQilc0jhoZabHD aIgEDadBB/NEa98I2fQokiTx4YzF+qk9knV8u7MmQJa3Je9AOV9bNVHswvZMfITKSNuc 1EtALmKWJ7KNJW/kRB6iP2qv80aoVE0SiSTBiDBUx2dxyh4C3WKGCJl37pMFENGOfcQS N6ew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=q+5OvfTk; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-85467-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85467-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s25-20020a170906285900b00a3e5ad050a5si1918137ejc.983.2024.02.28.09.52.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 09:52:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85467-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=q+5OvfTk; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-85467-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85467-ouuuleilei=gmail.com@vger.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 am.mirrors.kernel.org (Postfix) with ESMTPS id D19F71F29418 for ; Wed, 28 Feb 2024 17:52:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14F1E15DBC3; Wed, 28 Feb 2024 17:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="q+5OvfTk" Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CDF315DBC1 for ; Wed, 28 Feb 2024 17:51:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709142718; cv=none; b=YLOUX5gD+mdQp+AsM7btBbWyCLRi7F3Bl8rURqXBhOkpBwVWCNrmkYc0KS4zHzOiGIQ9OtbwPbtJi6GP4MvquoMoxiI1cYCdGR6pI+V8iwIOu6EII31pdKec0EmVrx1VFASRG7Tuq8MfujCm5Ln3kRBOCy/s5xOGmKPyyEaDPM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709142718; c=relaxed/simple; bh=DYg0LXB04IOIyfloSAJ7RhMuraWDe4p86DhfIeb4hC8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=DAIHeo8G8rYlfcuMePtzLRyrMLhtMlSbKw3A67l6++jxwlRXP98aPH2taxht3VA1tjfs6U+2+Y/qUrdQIqWjbaU5NTpY5o81ITf7n9RPLkzz5tK+DRzGfztfN98CjzFAJUqKww24rTLMX2r535vS+uW8AQR9VorhSLdUHbBCQY8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=q+5OvfTk; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2d094bc2244so70571191fa.1 for ; Wed, 28 Feb 2024 09:51:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1709142714; x=1709747514; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2PXWhKeObjvrv5a0sp4dojdugZSvAvimHcwo4W++JCk=; b=q+5OvfTkSQ/neuhhx5Q0jFSnztg1vpt3gWh4/SFdi74J+3codoxO0txrzjdShKsu1R HCsBYu6B0mr402b+kTaCrhfMkvasPz8VUTX38YTBU1/jJ9UgwdzHTB6sMnNKpk/ELt5B 1g0h0QY0gUDOaqoaqZTZEyB5TU+nCH1N5fAhtTOFjMAQwIduLWgi+Y9bMJl9GCSBiOwO gr0YJ2tBCj671JkaVTtsOyUTS5B5QHtR9nW8DCmxRR2RAglEIg9Iu5VDbN8QjaP21YJX 5KFKM6zUOOVhQVm7abrDJ0BZEdbTueAlxePLkrwznjNoNZLQ/n4EeJmZZ6hnN+D7wVQM GsSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709142714; x=1709747514; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2PXWhKeObjvrv5a0sp4dojdugZSvAvimHcwo4W++JCk=; b=vV+nRTYAqEWPeHuvmHUtMIgwCEBVy0sG5NeOoWzTIKI2lEitX+3kwSnHWJ33TkYKL4 DZy1/nFZPHSFaWoYUvXYEAL26dN5ydH59ZSmY4VAE2JVXpa8ETgBMBEAF4K/H3BM/22e RWei32+8CBZkceqwJzqgKTnhrG4iheytIiuv4egOBvGNuq6yeY91F15EiZYvAISWDcO5 NUAG8sQGoN6GzTs4oGmrUm4VyrcCEyherJ55FVBI6ut/3b7vSU4xijFkirvt0qC2gl4y k2ef3rUrxrejgitizneaHlCJVbbYNplVszEsz5/I4koAuS2sY2K43HnRjWyrESvf+a8+ kv7Q== X-Forwarded-Encrypted: i=1; AJvYcCVQwKjTVMtLJ6YHc7Tl+1rXvBsPiPGEMsSfGCsSDIzHMJgxnh44d4ynwFq3L4DHDtVVv7lAMXY0sOtMqTzMR5OthN7LeLetq/Z6w9Uz X-Gm-Message-State: AOJu0YxTpj9TxtbhgCn3w9rmAyOxhy3mfnc+Zfe040G08JAsMPB6rLAJ Vb8sRnFyVl/l5nW4zJGV2Vazohw7fG+XQOwGB9VNVtRRo+RZDnpDbGA1eBnaXwg= X-Received: by 2002:a2e:994c:0:b0:2d2:3017:c144 with SMTP id r12-20020a2e994c000000b002d23017c144mr8654944ljj.39.1709142714369; Wed, 28 Feb 2024 09:51:54 -0800 (PST) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id m20-20020a7bca54000000b0041290251dc2sm2706543wml.14.2024.02.28.09.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 09:51:54 -0800 (PST) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrea Parri , Anup Patel , Steven Rostedt , Masami Hiramatsu , Mark Rutland , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH 0/2] riscv: fix patching with IPI Date: Wed, 28 Feb 2024 18:51:47 +0100 Message-Id: <20240228175149.162646-1-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792166090556049163 X-GMAIL-MSGID: 1792166090556049163 patch 1 removes a useless memory barrier and patch 2 actually fixes the issue with IPI in the patching code. Changes in v2: - Add patch 1 and then remove the memory barrier from patch 2 as suggested by Andrea - Convert atomic_inc into an atomic_inc with release semantics as suggested by Andrea Alexandre Ghiti (2): riscv: Remove superfluous smp_mb() riscv: Fix text patching when IPI are used arch/riscv/include/asm/patch.h | 1 + arch/riscv/kernel/ftrace.c | 42 ++++++++++++++++++++++++++++++---- arch/riscv/kernel/patch.c | 19 ++++++++------- 3 files changed, 50 insertions(+), 12 deletions(-)