Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1583209pxu; Sat, 12 Dec 2020 18:51:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQjmPYqvxSWCddvSLbpdUaOvAUiicSdNMRG18ZAhHh38QA9EHJ5mmYKWgweZ4oxYqNDSl3 X-Received: by 2002:a17:906:82ce:: with SMTP id a14mr17237834ejy.421.1607827865570; Sat, 12 Dec 2020 18:51:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607827865; cv=none; d=google.com; s=arc-20160816; b=yK5jxgRQLM5JoWhhZUsTJaututvY6LiuidE6/XD8/82gRqasbIc0FLc11VVsnVPiEi 5iy7Z70uUNaS71LKszmq/MSlnO8L0yGJVKyin+aT8AR4maQk1nMNNqiep/EhOt+XgEcG Gd88VeXDkVWBuX8t9lQbQp/o76PwvlMeRp3MQ8H3B4QkbJ2pLiV2huoXl3N5GdJG2BNf fU1yqjgw/1+cZZb9y40gzo7riuCESBFep6aMDnaKbAgqUV6XvkcLYeQZcs9B702pSZr9 4csIsA6/+tvIkxxT4t7DoZpPC+vtOiwCQgnK4iRMZFuJ49akRVcb6xEWU6h0zopW5ND4 sx6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to:subject :cc:to:from:user-agent:references; bh=H+TJg84dCsjDpl/HzwteBOykCoShIOSQhxPT3Xq3gNU=; b=QIX377K6cs0xoerR3vwUzWc+34NxnstZv2sZARJzQxST4L/vOx3Szc2CzG9h4rPW3+ Y0l4n7jUnUECoufVamkQwnLgmAHJq9zsYPWtV4YTZC8Yk9taLsTO5HhyfXknnhsr3C0e bqvZSeKRj7hlIHjeFUt947MUSW86tYC3r7La23rm6ZgWZbSKzL3nl5/YYR5XxGRajQHt EUSbtxzFRhHTJAvaBRe7VewsZJo7RbS3m7IYAOkkgZHn8+BXMvIXKpv9yitqWHHEkgWl wKgzdVX1t4u6nSbTtYJ/EGj7CfFg/59tEhi8Rw56prudCCgBEpOnOzeFoe0P5atcDFhT A2Og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si7574316edi.179.2020.12.12.18.50.43; Sat, 12 Dec 2020 18:51:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392524AbgLKUru (ORCPT + 99 others); Fri, 11 Dec 2020 15:47:50 -0500 Received: from foss.arm.com ([217.140.110.172]:51820 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390401AbgLKUrR (ORCPT ); Fri, 11 Dec 2020 15:47:17 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 134DC1042; Fri, 11 Dec 2020 12:46:32 -0800 (PST) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 377123F68F; Fri, 11 Dec 2020 12:46:30 -0800 (PST) References: User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Reinette Chatre Cc: tglx@linutronix.de, fenghua.yu@intel.com, bp@alien8.de, tony.luck@intel.com, kuo-lang.tseng@intel.com, shakeelb@google.com, mingo@redhat.com, babu.moger@amd.com, james.morse@arm.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] x86/resctrl: Fix a few issues in moving a task to a resource group In-reply-to: Date: Fri, 11 Dec 2020 20:46:27 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Reinette, On 03/12/20 23:25, Reinette Chatre wrote: > Valentin's series in [2] ends by adding memory barriers to support the > updating of the task_struct from one CPU and the usage of the task_struct data > from another CPU. This work is still needed and as discussed with Valentin in > that thread the work would be re-evaluated by him after seeing how this series > turns out. > So the "problematic" pattern is still there: a context switch can happen concurrently with a write to the switching-to-tasks's {closid, rmid}. Accesses to these fields would thus need to be wrapped by READ_ONCE() & WRITE_ONCE(). Thinking a bit more (too much?) about it, we could limit ourselves to wrapping only reads not protected by the rdtgroup_mutex: the only two task_struct {closid, rmid} writers are - rdtgroup_move_task() - rdt_move_group_tasks() and they are both invoked while holding said mutex. Thus, a reader holding the mutex cannot race with a write, so load tearing ought to be safe. > [1]: https://lore.kernel.org/lkml/CALvZod7E9zzHwenzf7objzGKsdBmVwTgEJ0nPgs0LUFU3SN5Pw@mail.gmail.com/ > [2]: https://lore.kernel.org/lkml/20201123022433.17905-1-valentin.schneider@arm.com > > Fenghua Yu (3): > x86/resctrl: Move setting task's active CPU in a mask into helpers > x86/resctrl: Update PQR_ASSOC MSR synchronously when moving task to > resource group > x86/resctrl: Don't move a task to the same resource group > > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 159 +++++++++++++------------ > 1 file changed, 82 insertions(+), 77 deletions(-) > > > base-commit: b65054597872ce3aefbc6a666385eabdf9e288da