Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1751275ybc; Wed, 13 Nov 2019 03:51:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzMbRkBJ0RAbSnpqilEKrKuQsdtBqUQJNXT3B1yFcYBJXAXDVJcvtZhMn5TbD9MGDQARDoi X-Received: by 2002:a17:906:5397:: with SMTP id g23mr2200517ejo.93.1573645869828; Wed, 13 Nov 2019 03:51:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573645869; cv=none; d=google.com; s=arc-20160816; b=A49RX/hmiBw91QbgaArOmXO1i4oPGRXlhX5sy3d4JUSx9EOztZa40NN0vUMaYV+4Lp NbER/+lpE0EnkZkWtD50mqOHL8yziUjwpSGEnVqlTifyftIkS/0x4C7V9ja8GazsaENj My4IZOB6QFLIwzF/LPJkorgtWo2BfuUUsrnAqRLyoVCjSsDEPMu4FpO02je1h/qX7WQd pATXPi9X/FZMal7zCgkfj8GOJH4CX03BpIyvjc09fogty8bzlYlvC0fxyCdzguswBwMg Uq+7m/3F1ZpXPeWUKz3KjYQrpTshyjlIQ3kKk2PYkknT+R8yiR1WukS0w2bMUXR5S1Sz S7ew== 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:date; bh=z6d0JnpClOnR7u7NGtuteBYvD+q50oiALIO0Gf1hdBE=; b=GC9zJU9e2/voMoWCdX6NWtYMwlP/71g9ngJibP1ljQXKwbMw/u6Ii355qEQB2uOYXs EjX7NsXbuGyh5jI4ROvkdm6hb5mWVs6DXOdKki4+Tg53Rs8czb6NonWO2AZVEtZifAqB dlcCu/p89d2q34S8j2L2D+5F9Pp+Q0AfyUgNf8TGTx2YF7xdnCZ7YoBMWPbeqjfB0imz LdmkaDoizG12DgWW62vGUCzTwU13pJYOAQ9JFjSW3cmVcxdRA+gTfBAJ3vrTPUwe4fTV 6/axs1mQHytD04lQAmExVr/xGH5zqjhiiKVPcV1IE3UzKSn79vsHtIDu8yvBAEelU+wI ju7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb6si934203ejb.359.2019.11.13.03.50.45; Wed, 13 Nov 2019 03:51:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727960AbfKMLrS (ORCPT + 99 others); Wed, 13 Nov 2019 06:47:18 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:37477 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726949AbfKMLrS (ORCPT ); Wed, 13 Nov 2019 06:47:18 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iUr75-0003gc-Ge; Wed, 13 Nov 2019 12:47:07 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id F2D731C0092; Wed, 13 Nov 2019 12:47:06 +0100 (CET) Date: Wed, 13 Nov 2019 11:47:06 -0000 From: "tip-bot2 for Xiaochen Shen" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/resctrl: Fix potential lockdep warning Cc: Xiaochen Shen , Borislav Petkov , Tony Luck , Fenghua Yu , Reinette Chatre , "H. Peter Anvin" , Ingo Molnar , pei.p.jia@intel.com, Thomas Gleixner , "x86-ml" , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <1573079796-11713-1-git-send-email-xiaochen.shen@intel.com> References: <1573079796-11713-1-git-send-email-xiaochen.shen@intel.com> MIME-Version: 1.0 Message-ID: <157364562654.29376.17634958855166579949.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 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 x86/urgent branch of tip: Commit-ID: c8eafe1495303bfd0eedaa8156b1ee9082ee9642 Gitweb: https://git.kernel.org/tip/c8eafe1495303bfd0eedaa8156b1ee9082ee9642 Author: Xiaochen Shen AuthorDate: Thu, 07 Nov 2019 06:36:36 +08:00 Committer: Borislav Petkov CommitterDate: Wed, 13 Nov 2019 12:34:44 +01:00 x86/resctrl: Fix potential lockdep warning rdtgroup_cpus_write() and mkdir_rdt_prepare() call rdtgroup_kn_lock_live() -> kernfs_to_rdtgroup() to get 'rdtgrp', and then call the rdt_last_cmd_{clear,puts,...}() functions which will check if rdtgroup_mutex is held/requires its caller to hold rdtgroup_mutex. But if 'rdtgrp' returned from kernfs_to_rdtgroup() is NULL, rdtgroup_mutex is not held and calling rdt_last_cmd_{clear,puts,...}() will result in a self-incurred, potential lockdep warning. Remove the rdt_last_cmd_{clear,puts,...}() calls in these two paths. Just returning error should be sufficient to report to the user that the entry doesn't exist any more. [ bp: Massage. ] Fixes: 94457b36e8a5 ("x86/intel_rdt: Add diagnostics when writing the cpus file") Fixes: cfd0f34e4cd5 ("x86/intel_rdt: Add diagnostics when making directories") Signed-off-by: Xiaochen Shen Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: pei.p.jia@intel.com Cc: Thomas Gleixner Cc: x86-ml Link: https://lkml.kernel.org/r/1573079796-11713-1-git-send-email-xiaochen.shen@intel.com --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index a46dee8..2e3b06d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -461,10 +461,8 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of, } rdtgrp = rdtgroup_kn_lock_live(of->kn); - rdt_last_cmd_clear(); if (!rdtgrp) { ret = -ENOENT; - rdt_last_cmd_puts("Directory was removed\n"); goto unlock; } @@ -2648,10 +2646,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, int ret; prdtgrp = rdtgroup_kn_lock_live(prgrp_kn); - rdt_last_cmd_clear(); if (!prdtgrp) { ret = -ENODEV; - rdt_last_cmd_puts("Directory was removed\n"); goto out_unlock; }