Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp451930lqg; Thu, 11 Apr 2024 07:50:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVro1IBj66ymktLcCmJACKiMD3cxicjXxHLMYgNyh4QmfSsNtK5BSq9u4fQ9WbHSO8uZ0LlFgFxwfNJeXdVgltTjEZjI3hLckHGSCRwUg== X-Google-Smtp-Source: AGHT+IFw8V0CUQQLGhObdlkCBxd6xQ8sbZA0KAciLe9MYWpwxXfwH5h4V7tYx0MVvpYVoH/Ro5p8 X-Received: by 2002:a05:6358:b586:b0:17c:1e6c:14c0 with SMTP id wa6-20020a056358b58600b0017c1e6c14c0mr7213052rwc.16.1712847044005; Thu, 11 Apr 2024 07:50:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712847043; cv=pass; d=google.com; s=arc-20160816; b=NVGT7ytNsR+JPUKi/x81ATTzOeJDP6SsZ2pQtQe516vMBzC76nxq2FZgBx1r13wiMQ xK67RFxE+gcsUYssJYOVLZgGKSdmtbc/HbK/KXNoF+hl5uDJ/JY5RuLb396i0KrHnCH+ +tJurlZbUJsGB+Lme+DP7RtvEGaKrsd2aYqgA+JrH/UaXU1HcqDGY9gQZ0IpTFrEn/uU jKyq6iWEJFYFyeXKs8eD3r//dBAR/VHeWooB5L9ob3YVoNDSXq+sXzOXZ0XZT5/jnHZm 1/w5WIaTDT3AVH5nhu8m6i+QOTB34L1FoDmjlO4ey/q77dJ4ZJwFFdglboN/myzIEwR3 wD/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=Dd/UMXyYC74Up58IgxMXVEe50262VThG9dMMPKoWfnY=; fh=QpfXcl1MWRNwK/PrSFDaf8vyLNOqSjtq+qtJ/l97qlo=; b=wLAEercZVSQ/IPbBmnBDA2xuRI+UgNFeF69G4e9WorcFT3yX79WXC5I5a7EGmm28j5 dt2hCibw/oieN/n/uzWoqh+OBB/SQbrZqTHo9D+W3ZzUjjRs4CLa9LT8e3R5ltkHglpc IlEx9YYjtwOC3FAEd58q8Wh/ESuSU3HESxAtct28C6f3dDTKCa75/R5PRaVUOc6Zm4ND 6JqGCglXZpdcuv5aSW9pt1fRBGWTV1QsDdUKnQIk8mLIpkyMdaeTo2vgi7cZQ5IeyIJO MRx7d/Dh/PO+EI9xzFm/ltpIir1B74XZ3wGT5G56a7aG+/j8KQwlEwpsObpvTIztqUsN GIiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-140626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id g14-20020a63110e000000b005d6b61e24afsi1349911pgl.763.2024.04.11.07.50.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 07:50:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-140626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3C858B2AAEC for ; Thu, 11 Apr 2024 14:18:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1C5414D435; Thu, 11 Apr 2024 14:17:41 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D43514D45D for ; Thu, 11 Apr 2024 14:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712845061; cv=none; b=o/9FC4+qCOldUQXxfymYq4wp8OMQJwv8FVnEPvrPvnJ3ikwcyhehDy8OFfsUlZqwgt2YoGBVVPEFnUGAixDFBlWmnqAngwt0rG4ZmBrlDhu9ZBQv31bdAdhga0tnn0PVUkRyB4OAc0v3Aq7kjorYZR8+cyemb7zopar2onmH7mQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712845061; c=relaxed/simple; bh=xuNCmJ693hUGjHHj4/JkD+xhls4nmb8lLaS8Z6bnGN4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kUm9NeCYhGzrEcMWazq1o2iu9d8sVdrUL91P01XKVy1wRfGr+JV/N+ZP42pb40ObBVSvRGigBheaHywEpT0vygW06oUDFVigL+X+jcUIcSSAHWXZAtyQIwRGLXrl0j+4KgLaImPf6QaRkd2wmeMTG/cCTYGO6klhFusEEilAgLw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 29055339; Thu, 11 Apr 2024 07:18:09 -0700 (PDT) Received: from e133380.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C9D403F64C; Thu, 11 Apr 2024 07:17:36 -0700 (PDT) Date: Thu, 11 Apr 2024 15:17:34 +0100 From: Dave Martin To: Reinette Chatre Cc: James Morse , x86@kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , 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 , Rex Nie Subject: Re: [PATCH v1 20/31] x86/resctrl: Allow an architecture to disable pseudo lock Message-ID: References: <20240321165106.31602-1-james.morse@arm.com> <20240321165106.31602-21-james.morse@arm.com> <6d563361-87c0-474d-812c-b33e79eacf3a@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6d563361-87c0-474d-812c-b33e79eacf3a@intel.com> On Mon, Apr 08, 2024 at 08:24:12PM -0700, Reinette Chatre wrote: > Hi James, > > On 3/21/2024 9:50 AM, James Morse wrote: > > Pseudo-lock relies on knowledge of the micro-architecture to disable > > prefetchers etc. > > > > On arm64 these controls are typically secure only, meaning linux can't > > access them. Arm's cache-lockdown feature works in a very different > > way. Resctrl's pseudo-lock isn't going to be used on arm64 platforms. > > > > Add a Kconfig symbol that can be selected by the architecture. This > > enables or disables building of the psuedo_lock.c file, and replaces > > pseudo_lock.c Noted. > > the functions with stubs. An additional IS_ENABLED() check is needed > > in rdtgroup_mode_write() so that attempting to enable pseudo-lock > > reports an "Unknown or unsupported mode" to user-space. > > > > I am missing something here. It is not obvious to me why the IS_ENABLED() > check is needed. Wouldn't rdtgroup_locksetup_enter() > return -EOPNOTSUPP if CONFIG_RESCTRL_FS_PSEUDO_LOCK is not enabled? > > Reinette > Hmm, if I've understood all this correctly, then it looks like the existing code in rdtgroup_mode_write() relies on the dispatched function (rdtgroup_locksetup_enter() etc.) to do an appropriate rdt_last_cmd_puts() on failure. If no function is called at all and the requested mode change is not a no-op or otherwise trivially successful, then it looks like we're supposed to fall into the else clause. I'd guess James' intent here was to use the fallback else {} to write a suitable status string, while keeping the stub functions as trivial as possible. Just taking the IS_ENABLED() away would result in error return from the write(), but no suitable last_cmd_status string. For consistency with the existing x86 implementation, I wonder whether we should put a suitable rdt_last_cmd_puts() in the stub for rdtgroup_locksetup_enter(). There might be other ways to refactor or simplify this, though. Thoughts? Cheers ---Dave