Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp849910lqc; Fri, 8 Mar 2024 13:39:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXQS4uGHe5PPRUZogMeeUTMYV0sDMPu16hEAkFI0JAaJJIxE1UEydnTsM4Mq9LvQ34CQMtZv5bO36Y1v2RYTiB/pXSrwxvWbL83igvaWg== X-Google-Smtp-Source: AGHT+IH7E1y9iPkrobB8SHEVNWE919RLTbHhez2+EBcNE/yjUy6QDAaI7Kqav/xfUJfnImaCsjg8 X-Received: by 2002:a17:906:bc89:b0:a45:2e21:c776 with SMTP id lv9-20020a170906bc8900b00a452e21c776mr171039ejb.3.1709933946218; Fri, 08 Mar 2024 13:39:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709933946; cv=pass; d=google.com; s=arc-20160816; b=vOK2HxAHSxA7gyRg9WabMM1FaB7SCKhaLpxBgn/JkvIM2uu+FiXPXrYfL/H/GiOXBd wHePOg5zyr8W2zK+obNBW9HP+0mDAeJh29AB3szeqT+udOsYsTNw4cC3G/fVsYB18Tf3 f6lueBC5nSWJUMzFwxa5x1iBWORt2+tSRV3O6YOclvrh84YsO1sYnSGzVX21wQHmGcVr tuoSF/M0txit49yCApR7DRGyzU4dHCyA9B7JFXQCaOd6E+onBPuX5+B/j+yLtkqen+TD 68uGk6NEawxEd8w7MEIkv6NK3otwK8eEkyOjze+LeVDlQL7al8xxds5HbGhU7Xrhq4/1 1EbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Rq6uLHiKAEva1kOc68ZlKyo+z3W8cg1lPNsf+SGGRwY=; fh=qHRsCARCg6RsyjsQiEe76lsRl43M63OUqxFxrewbNwI=; b=mds/gXsSfQ+ueenR93NGJpBurrYzxosnPmxMMlkii1zeEQXP0dq9sYng2yzYMgV9eT MqBMQf5fH56efYykSY+OrgskXUt12et808VPJsJM4MWBNIm6zncBC1Cz/bViWydF8rgk TCiccUetKLhHZyVkmCjgFlEp5avy7Y8yw8dCDJrYbowo/yj91Li6DcRFlVwqWPb75WdI D/qHIKfTjuA6j4zA7y1OX45me8go8hC+RF0bz7xH0gGxsn2YKcjRZQwUqbKLtfCtH1V1 Jd4WDpXVZOfr/cyDFXSWGyEWZREERYxNR6z5JSMGZiBbvTQcGGhrX6GoTpObcwemh5ca 33Rw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=av+k5kvs; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-97610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t10-20020a1709064f0a00b00a4323f62581si150037eju.768.2024.03.08.13.39.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 13:39:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=av+k5kvs; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-97610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C74301F21BED for ; Fri, 8 Mar 2024 21:39:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3437D5FB8A; Fri, 8 Mar 2024 21:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="av+k5kvs" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04935367 for ; Fri, 8 Mar 2024 21:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709933939; cv=none; b=m9t4A2+E2ebafnarYsBKy6uxBGTBSXBDNoJekpIpnZaWUOvvOqPPzEmMuWgKdOXv/4CxOnMk/xWro0VPEuHOZRYH68YEA2/zWKKqPUcqNFJMIhPXRLmMNVRCxJoDqJdUh6Rym0nb6V9t+P8SKDLAyfnvtO5pppEwcmEVtkWXf44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709933939; c=relaxed/simple; bh=kxNK4cnw8Vs8KnalpAtNlUYJdvIRzgnBC990Rf7n8HM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i8IGOuDlh9RXt6Hc7b7yIBxJqQmY6ZGLGUX+qFKwpNxi7Pw4jF+W+xvcrStra1Fa+E9h3+bq+TJ/vdto8SogWZ3d3u4oWrRoMdP5Oy6YRe2FNeG9O3G5AioaXYcJ4Ijby17PoiKkr9U+iAxHYqm6NG6nDgU9p1aEnQF7FB42XGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=av+k5kvs; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709933938; x=1741469938; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kxNK4cnw8Vs8KnalpAtNlUYJdvIRzgnBC990Rf7n8HM=; b=av+k5kvs+cA1aCChvat3PWDem+S7t0K5QhkqF2q3uLq7c2ZY6PywS+TI drPOC/VfWtvILWexenneMqMrcI9Ia821LltcvmUZyAUIw5ysrhp2zyvSx V/MnybCLHQxeBioUbt9HbOwNWUBKO6b6GF/l/IR7FyfGgcOxPQbDESjkH wtbLsu4YBjcLfkpSwwY1K5p07Xj7lwRnuplNWrf6oZGx5+IDu/CZuuOSS 8d+XijJZ68cL69IvXewnkKJu7v6zSh6D+AJRgAtqKkCc2vis1DE2MYKaS fES5rbpy6Wfs7c0yH5Bh2Tt38RBW70N1jG7UqLFd8TbnkU2gLc+Q41ygO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11007"; a="4811384" X-IronPort-AV: E=Sophos;i="6.07,110,1708416000"; d="scan'208";a="4811384" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2024 13:38:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,110,1708416000"; d="scan'208";a="15295078" Received: from agluck-desk3.sc.intel.com ([172.25.222.105]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2024 13:38:56 -0800 From: Tony Luck To: "Chatre, Reinette" , Borislav Petkov , James Morse Cc: Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org, "Yu, Fenghua" , Ingo Molnar , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Tony Luck Subject: [PATCH v5 0/2] x86/resctrl: Pass domain to target CPU Date: Fri, 8 Mar 2024 13:38:44 -0800 Message-ID: <20240308213846.77075-1-tony.luck@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit reset_all_ctrls() and resctrl_arch_update_domains() use on_each_cpu_mask() to call rdt_ctrl_update() on potentially one CPU from each domain. But this means rdt_ctrl_update() needs to figure out which domain to apply changes to. Doing so requires a search of all domains in a resource, which can only be done safely if cpus_lock is held. Both callers do hold this lock, but there isn't a way for a function called on another CPU via IPI to verify this. Commit c0d848fcb09d ("x86/resctrl: Remove lockdep annotation that triggers false positive") removed the incorrect assertions. Add the target domain to the msr_param structure and call rdt_ctrl_update() for each domain separately using smp_call_function_single(). This means that rdt_ctrl_update() doesn't need to search for the domain and get_domain_from_cpu() can safely assert that the cpus_lock is held since the remaining callers do not use IPI. Signed-off-by: Tony Luck --- Changes since V4: Link: https://lore.kernel.org/all/20240228193717.8170-1-tony.luck@intel.com/ Reinette: Only assign "cpu" once in resctrl_arch_update_domains() [but see change from James below] James: Use smp_call_function_any() instead of cpumask_any() + smp_call_function_single() to avoid unnecessary IPI in both resctrl_arch_update_domains() and reset_all_ctrls(). This eliminates a need for the "cpu" local variable. Tony Luck (2): x86/resctrl: Pass domain to target CPU x86/resctrl: Simplify call convention for MSR update functions arch/x86/kernel/cpu/resctrl/internal.h | 5 ++- arch/x86/kernel/cpu/resctrl/core.c | 55 +++++++++-------------- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 40 ++++------------- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 12 +---- 4 files changed, 34 insertions(+), 78 deletions(-) base-commit: c0d848fcb09d80a5f48b99f85e448185125ef59f -- 2.43.0