Message ID | 20221115141953.816851-1-peternewman@google.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2759042wru; Tue, 15 Nov 2022 06:26:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jzHBtNOsK99Ansql8U34oJZSRCJiZa68EjsbFs2hSifUmDHDKBqZ/layN6EyCEr2EzRqI X-Received: by 2002:a17:906:6843:b0:7ae:65e4:7204 with SMTP id a3-20020a170906684300b007ae65e47204mr13558665ejs.579.1668522390176; Tue, 15 Nov 2022 06:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668522390; cv=none; d=google.com; s=arc-20160816; b=e1gRNf4P5bIXbbM5xiqyNJOUN8KKXkhNUUGiE21lRd65C71Fg83qd+0c2dfRTqaEO1 AOQOBTsO7E/7Du7SIFA50Gd2swMKdkO5M/UZ1ESr8+iuf8fnqbU2M4JpZZLEB6mg/UY2 toolCIyWzsN0ZnvZ/8ljvKLFPDJ0NN0PlWDOiMt9I8hi9EyY8eRUJr1ZFJmL4/AV+Xbn EdJ6Vn/wCFd3M0iMejFa7wOxcZFiGHfP9dBEcCbs0Lo26//h1p3HsojawUFlBJd37Xpq bN+CQfb1ZKzHXIJYTLdXlULox1xRaYykI+HDoIaKLncqc28mx993a9BwFuieupzKsJvh ndTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=s58ZaaH7khykLAsdfR1PLA3uBVF9xAfHNVB2s7VvboI=; b=lo80qEjmAi5Au7DSSJTKYh93Nd5kE7eeRmz5R/YYR5WW1tavQuix0zTTIhkOWEA7sm 5Q2gMeXPqUpwxCy74YSHwTXp3cKJX/Qiga/qqvs/jfyqdHwKPEfJ1Zmr2JKrCg1nJDUo ednlKRH0WKdZ4sjuKh27/ygcbHP3ZrPVf7zlI7jIPoi427yTVSlgo9yLm0ERB/yDTqXl qFoPa3NQf8k33vvMbSCQ4ugEDU6J4GRcoaHEi7+Efomp+p26vJ91C35c5PMhYJYUC0Uo ASCtjWn8C6vnGmYDwUKUgfMBut5ihPPRcdgEk2yrtGXLQDCwR3allnHBVnz1XpGhFjh/ VkDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tKfLrP+X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020aa7ca44000000b00461b5ba990dsi11167999edt.78.2022.11.15.06.26.06; Tue, 15 Nov 2022 06:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tKfLrP+X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229948AbiKOOUT (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Tue, 15 Nov 2022 09:20:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiKOOUQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 15 Nov 2022 09:20:16 -0500 Received: from mail-wr1-x449.google.com (mail-wr1-x449.google.com [IPv6:2a00:1450:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 098F0B96 for <linux-kernel@vger.kernel.org>; Tue, 15 Nov 2022 06:20:15 -0800 (PST) Received: by mail-wr1-x449.google.com with SMTP id h26-20020adfaa9a000000b002364ad63bbcso2865166wrc.10 for <linux-kernel@vger.kernel.org>; Tue, 15 Nov 2022 06:20:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=s58ZaaH7khykLAsdfR1PLA3uBVF9xAfHNVB2s7VvboI=; b=tKfLrP+XEln6NMJiQ7YHCAJTjRksmIu8VAz+ouqeP6Xy8AiqHpXIoHExasSgJEJq9O fjKKC9RvAnbsG60De+PEzPxneZuqlAT0+UBiIwpOyvp9lu/kgSxdg/xV+JTHGhLnZwG2 mslf4b/dJZWP2SAqbvfII/SqWfJRTu4LkrEGOPU4Q2W57CohSVgMO2WrYVIrqywyHH81 xPT3uZX5EoqMV4E7n9cdj5FLkNOrHgzdrNH35/At6egv1FwmcMeurd+UQswLIt19ka11 LnQzF/m3pKhAR44E0/dwKz6PGSiImcah8RDPFeTcyqwlKY26joADsSbvoCpNMbRILsKp LpCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=s58ZaaH7khykLAsdfR1PLA3uBVF9xAfHNVB2s7VvboI=; b=7XDg5/sammb1Yqy8WqMEgrnhtwWP2/hDJjAvSECB4AkqXEgWvR+K4xlLoa2stiQdEZ sDUeMQ1bcKFamDLHl74/ZGdT0Zz4jcz1YXEOBpJtofOHyvOqT5SlfubQII7fO0X1KuiL vwzSi5Q0dWjcJ/cC4rJ2PNOl8mMYSu5SHdlwEQx+FaPclsXmP3I5jOfMu88BmwcA1/55 RyYSODkKxH8Or4MVnSuPVDcHkCX29Kjr3BFPivf6U0XiJxIV+4oQgUoMXFuJA0/HZs3R 9uSz8H/5p1/7SXzaWE/ShfGEhBCJ2uWhINFBVuE3Gm+eAJsxtdOV9221kBwyXTWFP+ZK tX0A== X-Gm-Message-State: ANoB5plGtgTEc1DBM6/cngwxwKGd0d+r3ke4MHDVCyChabzTM/jnoqXe Fzg0Tbvt/03bIc0W4rjPMll3fDl5nKPYb0sR7Q== X-Received: from peternewman10.zrh.corp.google.com ([2a00:79e0:9d:6:fe62:9ede:ae13:6fda]) (user=peternewman job=sendgmr) by 2002:a1c:c906:0:b0:3cf:71e4:75b with SMTP id f6-20020a1cc906000000b003cf71e4075bmr1766758wmb.114.1668522013552; Tue, 15 Nov 2022 06:20:13 -0800 (PST) Date: Tue, 15 Nov 2022 15:19:51 +0100 Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.493.g58b659f92b-goog Message-ID: <20221115141953.816851-1-peternewman@google.com> Subject: [PATCH v3 0/2] x86/resctrl: fix task CLOSID update race From: Peter Newman <peternewman@google.com> To: reinette.chatre@intel.com, fenghua.yu@intel.com Cc: bp@alien8.de, derkling@google.com, eranian@google.com, hpa@zytor.com, james.morse@arm.com, jannh@google.com, kpsingh@google.com, linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, x86@kernel.org, Peter Newman <peternewman@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749572533860736471?= X-GMAIL-MSGID: =?utf-8?q?1749572533860736471?= |
Series |
x86/resctrl: fix task CLOSID update race
|
|
Message
Peter Newman
Nov. 15, 2022, 2:19 p.m. UTC
Hi Reinette, Fenghua, I've reorganized the patches for clarity, following James's guidance. The patch series addresses the IPI race we discussed in the container move RFD thread[1]. The first patch changes group-wide CLOSID/RMID updates to IPI all CPUs. Now that the synchronization cost of correctly updating a single task is more than originally thought, we believe that it's cheaper to IPI all CPUs than forming a more precise CPU mask by synchronizing with all tasks in an rdtgroup, especially when there is a large number of tasks in the group. It's possible that this update could upset users who frequently delete groups with few tasks. If anyone is aware of a use case that frequently deletes groups, we can consider mitigations. The second one uses the new task_call_func() interface to serialize updating closid and rmid with any context switch of the task. AFAICT, the implementation of this function acts like a mutex with context switch, but I'm not certain whether it is intended to be one. If this is not how task_call_func() is meant to be used, I will instead move the code performing the update under sched/ where it can be done holding the task_rq_lock() explicitly, as Reinette has suggested before[2]. Updates in v3: - Split the handling of multi-task and single-task operations into separate patches, now that they're handled differently. - Clarify justification in the commit message, including moving some of it out of inline code comment. Updates in v2: - Following Reinette's suggestion: use task_call_func() for single task, IPI broadcast for group movements. - Rebased to v6.1-rc4 v1: https://lore.kernel.org/lkml/20221103141641.3055981-1-peternewman@google.com/ v2: https://lore.kernel.org/lkml/20221110135346.2209839-1-peternewman@google.com/ Thanks! -Peter [1] https://lore.kernel.org/all/CALPaoCg2-9ARbK+MEgdvdcjJtSy_2H6YeRkLrT97zgy8Aro3Vg@mail.gmail.com/ [2] https://lore.kernel.org/lkml/d3c06fa3-83a4-7ade-6b08-3a7259aa6c4b@intel.com/ Peter Newman (2): x86/resctrl: IPI all CPUs for group updates x86/resctrl: update task closid/rmid with task_call_func() arch/x86/kernel/cpu/resctrl/rdtgroup.c | 128 +++++++++++-------------- 1 file changed, 58 insertions(+), 70 deletions(-) -- 2.38.1.493.g58b659f92b-goog