Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1304708ybg; Mon, 27 Jul 2020 13:20:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYYetwzKt4lDAa+xUspE+c7516pyidMauVEqll6q5O70pUlaLvVgGFBN9BU/2DejvMC04y X-Received: by 2002:a17:906:434c:: with SMTP id z12mr21605234ejm.33.1595881223258; Mon, 27 Jul 2020 13:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595881223; cv=none; d=google.com; s=arc-20160816; b=uj9Zje0i5WNFaUV0Cg+YSoQJB5axmfSTpLy5tsAEbWprKuHsbVKNSGvPXR0fMX+Dgn xjjSVaHCd1WxEkTxKhdthPi4PjaKxOUxr6XsjScwbsIYl2H83kGgBvoDsvQM97Dv+/4D EjGcBdFClKQOpx9VhFRaVDPAohFsIzIp+zBWWnp8QIisCDHRhOAZsynoBv3pGf70vrq7 Xf1pgkGEsjSecFmmGKUnjmUZDxPsrlaLvipXfcQdLDIcFMWhmirmG6y0Kl0DbED4exMl 2bvIerA+YW+OwczvYNGm0V8r23wy/4pv9vB+vV8ySS/ZGfvwNSMbDMm+YZ+tZSNKSgQV CSZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=GEaUy1Fu1lp3m+GXiMScnx03WYprA9BtWxGSWIlMkLY=; b=y8qpvNzn/tATZz0x6LB2XaSeGi5Uycpi0O8NCyafxz7yndwF02Fc7JJVZXA3QOOjuv sJauQTHkG3VWZ6p1gLPPixkLEoEqdu3ax4IRzD0XIh+Oqoe1043FIyxukcvsV3/f0GnQ jjpCTjwNypn2251hcmGkq+/1Q7dupkBg9tZHG9SdX4kjuHORjWh1gbX1zNvROD6TN3cb /D+2bJ8KC1DuvzMiKcBzqK0F7Nht2W4kM0qozipVp0k74yFW5l4opEmkkMtln3YGGbW1 tU9O+Df8y4NGDK3J8wYGVBL6MZTFtMbgposZzRSid+HB2JxsdJ8iR3VuN3GmJHd9P1qx KXXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=solVB7kl; 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 de7si4940825edb.278.2020.07.27.13.20.01; Mon, 27 Jul 2020 13:20:23 -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=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=solVB7kl; 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 S1728903AbgG0UTm (ORCPT + 99 others); Mon, 27 Jul 2020 16:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbgG0UTl (ORCPT ); Mon, 27 Jul 2020 16:19:41 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F511C061794 for ; Mon, 27 Jul 2020 13:19:41 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id x9so8750653plr.2 for ; Mon, 27 Jul 2020 13:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=GEaUy1Fu1lp3m+GXiMScnx03WYprA9BtWxGSWIlMkLY=; b=solVB7klx3WtOFjPCehD4ovahfSWXpY6iMsiq40Rb4dqAUniRy9npg8YQ4JqKQNOuk J2hF6ajxMWTaBkunpx7+uJfzUPLXy2nlPcv+qGRfxFRT5cPoG6/Zx4KUQ3xe4eOpvbTX bfqTbFkgtlp4VVsjV6mQVU0hT6svzW0P8/FLzUwCXzzERMTaw+P5mSpMcYTmCm7i/nG3 oRQ61qrLW4XTYX56489z7Cits0SmPHnmJYR7G2Kjcaar9gM2v1nrLwefqTUdPxxYREvp PEfAhiVEsGKsWEV7UfKanP6gEFCbwP5dV6yaqWRRNbpmrkLdPHEJDF7j8P+o8euxW6L3 QcCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=GEaUy1Fu1lp3m+GXiMScnx03WYprA9BtWxGSWIlMkLY=; b=Edr5OQd22RSbzQJLexw3ZYieXWytZnqIJwooajItYMeaPo+L8VtO8GtkclQkgm1g0H caafUFzqbT2EbPih4vli6Gpgr0YkiOr5BTqB9HvI312GtZ+9j+pa296kZ4nkEO3qXnUQ j+U/32YRpiTPneqCdeQaLt4DR3QCvzDfGWjq6KqgAuYkVNHQp1L5YFYl4DdUEzAKR76/ zXULSccpV+eGJF4qKAWTRwwNIljHtTJJDU2oObyWkduXShHdegZHIHn0HnaDJWK7gIeT 5x8AJPMNKqwAGRSnbMvsvH7FcMSBsE0Dj/45dLgUrFsmMMQ8Kx0PDE5wR9vHd8YcZPuI wUHw== X-Gm-Message-State: AOAM531Jq9xRkpJerA4vh66V0ffCWnPYu7CcmsqL8Ro+JYz9z4nid5kD Eh13cfg6l0RM1SdfkW8JSjNXhw== X-Received: by 2002:a17:90a:2d83:: with SMTP id p3mr972544pjd.124.1595881180864; Mon, 27 Jul 2020 13:19:40 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id o10sm426540pjo.55.2020.07.27.13.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 13:19:40 -0700 (PDT) Date: Mon, 27 Jul 2020 13:19:40 -0700 (PDT) X-Google-Original-Date: Mon, 27 Jul 2020 13:19:31 PDT (-0700) Subject: Re: [PATCH] riscv: Grab text_mutex before patching jump-labels In-Reply-To: <20200723163628.82794-1-kernel@esmil.dk> CC: linux-riscv@lists.infradead.org, kernel@esmil.dk, Paul Walmsley , Bjorn Topel , linux-kernel@vger.kernel.org From: Palmer Dabbelt To: kernel@esmil.dk Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Jul 2020 09:36:28 PDT (-0700), kernel@esmil.dk wrote: > Like other arch's we use patch_text_nosync or equivalent > to patch the jump-labels, but also like other arch's we > need to hold the text_mutex before calling that. > > Signed-off-by: Emil Renner Berthing > --- > > Fixes: b6e0878a4ec8 ("riscv: Add jump-label implementation") > ..that is already in riscv/for-next. > > Palmer: Sorry, I didn't notice this before. Feel free to > squash this into the commit above if you like. > --- > arch/riscv/kernel/jump_label.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/jump_label.c b/arch/riscv/kernel/jump_label.c > index 1bab1abc1aa5..20e09056d141 100644 > --- a/arch/riscv/kernel/jump_label.c > +++ b/arch/riscv/kernel/jump_label.c > @@ -4,8 +4,10 @@ > * > * Based on arch/arm64/kernel/jump_label.c > */ > -#include > #include > +#include > +#include > +#include > #include > #include > > @@ -33,7 +35,9 @@ void arch_jump_label_transform(struct jump_entry *entry, > insn = RISCV_INSN_NOP; > } > > + mutex_lock(&text_mutex); > patch_text_nosync(addr, &insn, sizeof(insn)); > + mutex_unlock(&text_mutex); > } > > void arch_jump_label_transform_static(struct jump_entry *entry, I've just put this on for-next as is. I generally try to avoid rebasing stuff, but I think I saw a message today about a patch I put there prematurely so I might have to rewrite history anyway. If I do I'll squash it and a few other small fixes. Thanks!