Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp260885ybg; Tue, 28 Jul 2020 05:30:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuGnCVXa2rZZeaqbvU6zX0RlHtujBUtU1yzm/tvQRu9RUwSDbA5rNWDaC7UcJg0JT4unEx X-Received: by 2002:a17:906:fad1:: with SMTP id lu17mr19470641ejb.127.1595939431486; Tue, 28 Jul 2020 05:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595939431; cv=none; d=google.com; s=arc-20160816; b=aoUXBuFa5yYrwqC4lN6TUgibySuLAL57ujiSJ037k55iEFlZ8bCDOhGZ8RUOuJH/Le 1qVl+2ZWZoMgFE3WKKuLRj9zyfvrkVYdjFAZ61CCipaizmyVZD6dnxaV7Pu1Id69JPDA KcUkeJKBA5LA/XXEcWbbSsH4jBigpOQ/A7/KLMDYS7U4vWwv5qTCOZDjodpIgiZFsgBU 1VemPRkkIcGYEMXmHi00WcjXJkdxVytI3aZNBdEJDIFJMMxZ+miPSKJGdfVjPJiiBcJz FdhRPaKEE7MQQ+sVXqfiO61bQRD6IMp/gIN+5JVfwsPcUV9AhDSO40XaxENhT7kEgh2y GnZA== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=rI4p+p7PY7+lEZb3eDxP0kJaacGlY/NLIZWz8rMV/U0=; b=cOVEDRZuEcBC2wyaDtdbYUDqiRmSMWkP5eP1i0exCQbjl8XbzcZUVQ5CQi49Nmzkah Dx9mKdZIJHRpI9MKXGO35wzQQO+wz9C8sFoHMr24pH5Mb0aexLjHC0UaT0NsqyP60k/y Gdm2ItVK1kzjueQ7vyXbxzjQTj6xQjTMU00++QRaamym3XVNDgAk6cjupSyGLsLO6MwH 5F/zS3YpxI7HwrnX6ApKA3OB2WIGlp6v09HVdDLphY9aMMXivQ0Vc0D0Tdmka/Qf7WGx H70biuaTwII9hMbG0MGIaGtEAsIMpjfxbelWQJ4uHXUM69x1l2PbIJae2+8p3PeygsYN Lo7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=pxHNeRZM; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si5876388ejc.311.2020.07.28.05.30.09; Tue, 28 Jul 2020 05:30:31 -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=fail header.i=@linutronix.de header.s=2020 header.b=pxHNeRZM; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729594AbgG1M3J (ORCPT + 99 others); Tue, 28 Jul 2020 08:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729399AbgG1M3I (ORCPT ); Tue, 28 Jul 2020 08:29:08 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9867C061794; Tue, 28 Jul 2020 05:29:08 -0700 (PDT) Date: Tue, 28 Jul 2020 12:29:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595939346; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rI4p+p7PY7+lEZb3eDxP0kJaacGlY/NLIZWz8rMV/U0=; b=pxHNeRZMrsEPfLylenuhN1fExrnCQ0qPz3SaOsEsOZegNt41iewnDDt8ho2OHEYlUn413o k1OUpgqsVaIO0hpVh+PArT0lm2WxdLUuLpx2ZBbMAwIOqkQ7DRCCDI8BahhZ4fXEVlJHou CSw4/VZDrmW2aNYgDi5fhM9JeYrmkeqFVx5yu1NkMEGUsfg0/hbwDP1GQpK99sXjNIZtPw +qR71ssImI9rzvvoxCPjkDyBSCuK/YYHRbC5H0KJnJ2KFSQxT2FLQI9ehvwPuB5OsBuXeZ QJzNkn61Cwdc+IMbUwXJ4+PvWEiSRE90HQJewEe1xJENlR+blz+oohLY8dguFQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595939346; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rI4p+p7PY7+lEZb3eDxP0kJaacGlY/NLIZWz8rMV/U0=; b=1/iTDsNn4RKNat2rjRmQFmA+grMMFd6i9da5lBH++p+yMnDeKLH4xGv3LarMjIXRIW0JLk C2vJZpMRT0cSs+DA== From: "tip-bot2 for Masami Hiramatsu" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] kprobes: Remove unnecessary module_mutex locking from kprobe_optimizer() Cc: Ingo Molnar , Masami Hiramatsu , Jarkko Sakkinen , x86 , LKML In-Reply-To: <20200728163400.e00b09c594763349f99ce6cb@kernel.org> References: <20200728163400.e00b09c594763349f99ce6cb@kernel.org> MIME-Version: 1.0 Message-ID: <159593934624.4006.4213436208654596958.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 112a0e4171e111e963aada3fe790c71accf4d705 Gitweb: https://git.kernel.org/tip/112a0e4171e111e963aada3fe790c71accf4d705 Author: Masami Hiramatsu AuthorDate: Tue, 28 Jul 2020 16:34:00 +09:00 Committer: Ingo Molnar CommitterDate: Tue, 28 Jul 2020 13:19:05 +02:00 kprobes: Remove unnecessary module_mutex locking from kprobe_optimizer() Since we already lock both kprobe_mutex and text_mutex in the optimizer, text will not be changed and the module unloading will be stopped inside kprobes_module_callback(). The mutex_lock() has originally been introduced to avoid conflict with text modification, at that point we didn't hold text_mutex. But after: f1c6ece23729 ("kprobes: Fix potential deadlock in kprobe_optimizer()") We started holding the text_mutex and don't need the modules mutex anyway. So remove the module_mutex locking. [ mingo: Amended the changelog. ] Suggested-by: Ingo Molnar Signed-off-by: Masami Hiramatsu Signed-off-by: Ingo Molnar Cc: Jarkko Sakkinen Link: https://lore.kernel.org/r/20200728163400.e00b09c594763349f99ce6cb@kernel.org --- kernel/kprobes.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 146c648..e87679a 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -598,8 +598,6 @@ static void kprobe_optimizer(struct work_struct *work) mutex_lock(&kprobe_mutex); cpus_read_lock(); mutex_lock(&text_mutex); - /* Lock modules while optimizing kprobes */ - mutex_lock(&module_mutex); /* * Step 1: Unoptimize kprobes and collect cleaned (unused and disarmed) @@ -624,7 +622,6 @@ static void kprobe_optimizer(struct work_struct *work) /* Step 4: Free cleaned kprobes after quiesence period */ do_free_cleaned_kprobes(); - mutex_unlock(&module_mutex); mutex_unlock(&text_mutex); cpus_read_unlock();