Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1119791pxu; Thu, 17 Dec 2020 02:42:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpWo1CqhvLNi3VQaN9y5MXcMc3gCF2AUw3PsfCb1n/83e3dM0obKDAqBxe4bZu07FLRqiX X-Received: by 2002:aa7:c3cf:: with SMTP id l15mr38867258edr.282.1608201741843; Thu, 17 Dec 2020 02:42:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608201741; cv=none; d=google.com; s=arc-20160816; b=imWFH8l4S0BQYcXnqnGmpIFxI8EAAdV4Kv3qXZg5rZG1d2ihp+mOc5kBgS0tkIyHxh 60fcFiASb0bTO7j5bO6BH3MOqEb5RgzzwxcsRBo1FxxOEJFi9goDWXTjM9ICTDkNyYQw q0hkxdBMHbbjKueY0LnUqBkK+M66/HWYdZIBcpgSprv1s4sToQln2QNPqMkDSrGlVAhN MMoFGOOw/gpKqc3bvEEJKJuFDlOinG7tuZBF27uOSZ8Yy3MeBSyi8cWYjSZL0KfREOl8 YRG6l67p/yl8n2xGfddd+e2JX/diqy3G1ohyESYt4INcUMsNFivppcAHSEal7caUwWdB 4BBw== 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=0h40H3HZ4abjfHq3x4vx68z4aONefTYK9tSjsX6/ZTQ=; b=A8TAM5EY3/gCf7y1KFnAt6IKJ3+ZI7Dua/ZFFkAyhcPPOzenkcnoaCoq7UHQyS0TOY fCZ0//YrpJ7wykiTzCYZZub4LxJb3wUnIn2sKb6/ymDFk9ekJ95DpNJ+er7q1MlOi1RD fKMOkvxdGs3pXhpGgRzuLFnUzdiftdo/6G6TbxgWocxsQM64uX0amN+HJcLFngAsYoR6 /R9kEaVA/+kIAqPhtlDP6R17c6KktiWkAF+TEVWEqVPEzPH0iAaIpLotUgjRY9Wx5OTG vlfc6Y9ESt4X/F+ev2zV8+ex0Ib9LLSx/lHGkELTvQyX1f/UZGBiccTSVerOR8unoodm ZbEQ== 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 u17si4022467edo.494.2020.12.17.02.41.59; Thu, 17 Dec 2020 02:42:21 -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 S1727167AbgLQKkg (ORCPT + 99 others); Thu, 17 Dec 2020 05:40:36 -0500 Received: from foss.arm.com ([217.140.110.172]:56082 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725871AbgLQKkf (ORCPT ); Thu, 17 Dec 2020 05:40:35 -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 408FF31B; Thu, 17 Dec 2020 02:39:50 -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 453883F66E; Thu, 17 Dec 2020 02:39:48 -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, stable@vger.kernel.org Subject: Re: [PATCH 2/3] x86/resctrl: Update PQR_ASSOC MSR synchronously when moving task to resource group In-reply-to: Date: Thu, 17 Dec 2020 10:39:43 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/12/20 18:26, Reinette Chatre wrote: > Hi Valentin, >> So that's part paranoia and part nonsense from my end - the contents of >> smp_call() shouldn't matter here. >> >> If we distill the code to: >> >> tsk->closid = x; >> >> if (task_curr(tsk)) >> smp_call(...); >> >> It is somewhat far fetched, but AFAICT this can be compiled as: >> >> if (task_curr(tsk)) >> tsk->closid = x; >> smp_call(...); >> else >> tsk->closid = x; >> >> IOW, there could be a sequence where the closid write is ordered *after* >> the task_curr() read. > > Could you please elaborate why it would be an issue is the closid write > is ordered after the task_curr() read? task_curr() does not depend on > the closid. > IMO the 'task_curr()' check only makes sense if it happens *after* the write, the logic being: 'closid/rmid has been written to, does the task now need interrupting?' In the above 'else' clause, task_curr() would need to be re-evaluated after the write: the task wasn't current *before* the write, but nothing guarantees this still holds *after* the write. >> With >> >> tsk->closid = x; >> >> barrier(); >> >> if (task_curr(tsk)) >> smp_call(...); >> >> that explicitely cannot happen. >> > > > Reinette