Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp830532ybl; Wed, 11 Dec 2019 08:09:02 -0800 (PST) X-Google-Smtp-Source: APXvYqwGsQ16GqbKa/uOdFuwURkmTYwRd+3fBwebT59FGbeaEOkzhv4Zrv+n8feCs1wQQO0pJ5fh X-Received: by 2002:aca:1c09:: with SMTP id c9mr3506645oic.85.1576080541886; Wed, 11 Dec 2019 08:09:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080541; cv=none; d=google.com; s=arc-20160816; b=VZ7s3eS3XvwDO9Y8UR+7CedUk20ObwrpnaJDRrTr8UzUT03hImIJJOkDXGigNfIItJ CI5WQ0Vfvw0sdJvctZ6uNdI617Jh75WuzgkcCyf3W9uX9GRAYnMVTNlunJY7uf2fdTl5 +1xqyAU8JcBHcjxVIozDjq23Xa3PQgQzlWsIFWEHVKZxYHQJioZuUH1vc1/vDkng/fAg ruBKIB244YbPsM7oGmsR+DtRmCoDSJlB8cHzrk4Av2K/eqgSiv2g5kV/QEMEUSj013B0 ZlQTwZVOdsugbrPabJYSWbc6Kp57wNurBf/2d0qJdV/a/4Lp9jaW1ISHZWi2gFsiDqf5 bIbQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yMTMIaduhsKuG48yYrJtgSSexa/tAM1UDrTTNxqjBhQ=; b=OcyrNf4abbnvRPRHOcXTovad8hJrjvg2GSMWGesRwU03K8JtSnnXp0BbzU8ECpuR4+ m69CESX8icws0z/aHi6VAFEGLMLjzwaGbHg8+JUV/1a8qXbCo0kCkoJw8PANvXeRB5zN YWmGlpAyAo6ZDWfAalE1ybpq9PzeGWtZdR7onuQzii01ztUHo0AdC2GNYwpPpQe4qLE+ w+h/5LsEAak5zB3+GuDMT2PC9fOKtAVDfUrGJTUoiiCDO14fB7BhKyIsKlDAv7UW4YGz EHexwvLZXN98wnzc7DK9RrlW0H0KANGSCMgib5QOo0ALx+VPKlL6fOl7/V/URGCGCq/T Xs2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y5+/Q9xR"; 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 d23si1433934oij.270.2019.12.11.08.08.50; Wed, 11 Dec 2019 08:09:01 -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; dkim=pass header.i=@kernel.org header.s=default header.b="Y5+/Q9xR"; 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 S1732493AbfLKQHo (ORCPT + 99 others); Wed, 11 Dec 2019 11:07:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:33988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731122AbfLKPMZ (ORCPT ); Wed, 11 Dec 2019 10:12:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 B88842465A; Wed, 11 Dec 2019 15:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077145; bh=3RG25Jhwv4mFVx1aiqHTFVdZ7SyFBzyp0xOFY9JoQbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5+/Q9xRkkZvYmwKVtkPVA0d0cO44UpJYh62qpsBNj+6kfrMEUQsZqSCUxoGu7H5T W+AFVIZMQ2CGi1yHXzLx7DhvQJG5Vl9xeCYULB/sGXna9Q/9zRbxc41la8cIithAGt edqbqMN3qxrTw7u7VIJrRfpD9u0335KEc+6cE7wE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaochen Shen , Borislav Petkov , Tony Luck , Fenghua Yu , Reinette Chatre , "H. Peter Anvin" , Ingo Molnar , pei.p.jia@intel.com, Thomas Gleixner , x86-ml , Sasha Levin Subject: [PATCH 5.3 033/105] x86/resctrl: Fix potential lockdep warning Date: Wed, 11 Dec 2019 16:05:22 +0100 Message-Id: <20191211150232.774206480@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaochen Shen [ Upstream commit c8eafe1495303bfd0eedaa8156b1ee9082ee9642 ] 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 Signed-off-by: Sasha Levin --- 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 a46dee8e78db4..2e3b06d6bbc6d 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; } -- 2.20.1