Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp112969ybx; Wed, 6 Nov 2019 14:06:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwJejO+gOu01BcLAnixOwQDqgN4uVBOwrxKiLY2tKPSt0KzGjoBnOa189cAZ9/76MWVXmOV X-Received: by 2002:a05:6402:339:: with SMTP id q25mr54884edw.80.1573077975294; Wed, 06 Nov 2019 14:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573077975; cv=none; d=google.com; s=arc-20160816; b=gaNuz1GzC8FYbE0HjSrr8rfKjguYL+83/wvOUFuQhaVM6D64obRT3JNDZQxh4HqaDV htX3rmP1Mu0qur3oqkTTcnSQCb/+oNQAc3CY/seMTdumO5wxSEEU0JpCcV86hWNToW3s ZMrYxO2rEA6vrFtQpl2UT5gWuIT5qJlhTi6EKL6sDAOV6AlwdI3rudu3/FVUjL471NHt TXHB2iyn7LTFkuYoCk5I7GPgigcVetxrNTiHb+rBA7lQxLZQucVXB/FjeohXj8aD1L8f cb81FNzB4Fpl8YeyIMzR5liVehCBPH1tvHhv8eq0a3sX1a4ZRgVr+1MzHTyii7wX1q/O xRSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=tuePi+ahK5AP5V2Y9Co4PnG7SzUrwa+O1n05vqDhWJo=; b=huzmy3/cO7TRFl1mrbutu4JgRdnJBoT/gGHKI719CgI2rkegMBgx01oZGo9b/RUP/q 6qMi5s8MO6TUQcXbf861e+t9MFPytRd2VFTCdAH7TwPFHBp56r0gQqVuF/DwkFieSyC4 u6oetMqIHFgdSg1qpLfDvXV/1xHtmqhwqWuWFSA4yabJFHH6cDp/JF9AiCA8Zx3P8Aby QaJ22iPsv0UeEoAvc2GK/OhZpNnVq1tVmQ9SGBkwXatbbYU3zKvd7fB3IMbPNg79Mt5D 9bviFBnXvxUiBeXXuCsTgnYUDocDAaFUZgnuPF/b7XO24DzzkxdIERdxljuW6OKC5rAy YopQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si13969855ede.12.2019.11.06.14.05.49; Wed, 06 Nov 2019 14:06:15 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732156AbfKFWEK (ORCPT + 99 others); Wed, 6 Nov 2019 17:04:10 -0500 Received: from mga12.intel.com ([192.55.52.136]:17526 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726912AbfKFWEK (ORCPT ); Wed, 6 Nov 2019 17:04:10 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2019 14:04:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,275,1569308400"; d="scan'208";a="205969023" Received: from xshen14-linux.bj.intel.com ([10.238.155.105]) by orsmga006.jf.intel.com with ESMTP; 06 Nov 2019 14:04:07 -0800 From: Xiaochen Shen To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, tony.luck@intel.com, fenghua.yu@intel.com, reinette.chatre@intel.com Cc: x86@kernel.org, linux-kernel@vger.kernel.org, pei.p.jia@intel.com, xiaochen.shen@intel.com Subject: [PATCH] x86/resctrl: Fix potential lockdep warning Date: Thu, 7 Nov 2019 06:36:36 +0800 Message-Id: <1573079796-11713-1-git-send-email-xiaochen.shen@intel.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org rdtgroup_cpus_write() and mkdir_rdt_prepare() call rdtgroup_kn_lock_live() -> kernfs_to_rdtgroup() to get 'rdtgrp', and then call rdt_last_cmd_xxx() 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_xxx() will result in a lockdep warning. Remove rdt_last_cmd_xxx() in these two paths. Just returning error should be sufficient to report to the user that the entry doesn't exist any more. 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 Reviewed-by: Tony Luck Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre --- 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 a46dee8e78db..2e3b06d6bbc6 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; } -- 1.8.3.1