Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1564868pxy; Thu, 29 Apr 2021 09:33:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+nz/wJyyMZyeKIhjdpo3Iqlw8kza2tlRi/f+eSbnS4RSc39Z68B+JLw4OkOQxgMTZbi82 X-Received: by 2002:a63:5322:: with SMTP id h34mr563711pgb.182.1619714008465; Thu, 29 Apr 2021 09:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619714008; cv=none; d=google.com; s=arc-20160816; b=yFVFoalgfoaPgpTKThV/FgLAT1oYhwETQy5bqLtqMl01KN84jhSqIPxzXBjopduHN3 X2x/6NVMR9Mop6QjxDyYpAgg8+Rei8hb1xSf0aBqSJWIJcIj76wM5NM040Y1corY70p5 qgIQCKs3+TwV4VDzaH3CrtCeO/TIN9sGhB/NywP/s6tlISRwKbGFdqeM9wuYBu8gEmfv MOMTJciGaAmTltjfNq4apqXtt667n5tksNHFEKAvp7YVhQ9X6QFoBmqKSfIER7pSNXiU VvyGHkGf19GU3/xKwGNrP2JRRZfuqEzeVZg0OGMyGfAlJuq1hguViM2nTK0cQwRQjvPo OITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=pxNL48C8NJtjPjaOAPEd1rglpkan6UYHNC42+w9pH0g=; b=bMiUocRIOyagY9Q1xwrmHUQ8JPuSN7ujh4kFMgLPpsJhAnA3BdoQUDt1eIxUAlF+OO ewMhrwMIgv8nvP7C0/qB46KAgwRnMrUB7BGNIFediy4k9b4a19k3vuT53ytwWyNBBpMR 3fc9IwciQS0v1ZvU9G8sBptKeSCA/Y6sLPvG7P/Nf+aSjc9KEyI0nmXm0QPtWLKSE3U9 9oOZKk32LeGP8A7nuXZ2gkMUdDgEzrBj+CekrNxlS3iDbE4nky8qxLqXOxedv0G4vlR4 dydjanW+P5nIIc2qL0ubBibMw6fY67lVpHS6xPw8Uk8efn+zs6ZVxvU0PxlhBiVkxODD cl9g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y130si3810982pfc.151.2021.04.29.09.32.56; Thu, 29 Apr 2021 09:33:28 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240840AbhD2QbC (ORCPT + 99 others); Thu, 29 Apr 2021 12:31:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:56846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240873AbhD2Qa6 (ORCPT ); Thu, 29 Apr 2021 12:30:58 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 97C8961407; Thu, 29 Apr 2021 16:30:09 +0000 (UTC) Date: Thu, 29 Apr 2021 12:30:07 -0400 From: Steven Rostedt To: Palmer Dabbelt Cc: linux-riscv@lists.infradead.org, Paul Walmsley , aou@eecs.berkeley.edu, peterz@infradead.org, jpoimboe@redhat.com, jbaron@akamai.com, ardb@kernel.org, Atish Patra , Anup Patel , akpm@linux-foundation.org, rppt@kernel.org, mhiramat@kernel.org, zong.li@sifive.com, guoren@linux.alibaba.com, wangkefeng.wang@huawei.com, 0x7f454c46@gmail.com, chenhuang5@huawei.com, linux-kernel@vger.kernel.org, kernel-team@android.com, Palmer Dabbelt , Changbin Du Subject: Re: [PATCH] RISC-V: insn: Use a raw spinlock to protect TEXT_POKE* Message-ID: <20210429123007.5144fc0d@gandalf.local.home> In-Reply-To: <20210429061713.783628-1-palmer@dabbelt.com> References: <20210429061713.783628-1-palmer@dabbelt.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 28 Apr 2021 23:17:13 -0700 Palmer Dabbelt wrote: > From: Palmer Dabbelt > > We currently use text_mutex to protect the fixmap sections from > concurrent callers. This is convienent for kprobes as the generic code > already holds text_mutex, but ftrace doesn't which triggers a lockdep > assertion. We could take text_mutex for ftrace, but the jump label > implementation (which is currently taking text_mutex) isn't explicitly > listed as being sleepable and it's called from enough places it seems > safer to just avoid sleeping. > > arm64 and parisc, the other two TEXT_POKE-style patching > implemnetations, already use raw spinlocks. abffa6f3b157 ("arm64: > convert patch_lock to raw lock") lays out the case for a raw spinlock as > opposed to a regular spinlock, and while I don't know of anyone using rt > on RISC-V I'm sure it'll eventually show up and I don't see any reason > to wait. On x86 we use text_mutex for jump label and ftrace. I don't understand the issue here. The arm64 update was already using spin locks in the insn_write() function itself. riscv just makes sure that text_mutex is held. It also looks like ftrace on riscv should also have text_mutex held whenever it modifies the code. Because I see this in arch/riscv/kernel/ftrace.c: int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex) { mutex_lock(&text_mutex); return 0; } int ftrace_arch_code_modify_post_process(void) __releases(&text_mutex) { mutex_unlock(&text_mutex); return 0; } Which should be getting called before and after respectively from when ftrace does its updates. Can you show me the back trace of that lockdep splat? -- Steve