From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7E38C4338F for ; Wed, 18 Aug 2021 10:50:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E0D960F58 for ; Wed, 18 Aug 2021 10:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234969AbhHRKvU (ORCPT ); Wed, 18 Aug 2021 06:51:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234418AbhHRKvL (ORCPT ); Wed, 18 Aug 2021 06:51:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 96ACC60FE6; Wed, 18 Aug 2021 10:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629283837; bh=XJJfqGaPKfZfagBQ927PihOmY2pne9eerFWpT3CGI8E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kPFj3oNMMBS61IZ+/x/n1lPqaD2WApPac4c/9QLZHaQOID4+TPfvozGIH0QziDPpF XSUP6TSX9lKydwgjpwEJKeNjQBPERgiW3kUoT+cL/H0MMLXpuPmEkQ4Isz28lWcAfh FBMyLVDcouPuEjZCuTDnllR4t6Upmxn37yLBm4B6wBOFqbWm/dAt8kBQKKhDCkg74G Z74Pg8yJ883UCwH2oHW17D5zyEj3gecruyx1rhdmLA/X0cx6SH3mW0YCV4Vi64PPQJ xaSbgb+v4V0DjJgiBCr+s6uReBdal1b8MJY39gEO/b/UK+QJA/antzNXauFCI6eYve WS9J7Fi+0uHvg== Date: Wed, 18 Aug 2021 11:50:30 +0100 From: Will Deacon To: Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , Dietmar Eggemann , Daniel Bristot de Oliveira , Valentin Schneider , Mark Rutland , kernel-team@android.com Subject: Re: [PATCH v11 07/16] sched: Split the guts of sched_setaffinity() into a helper function Message-ID: <20210818105029.GC13828@willie-the-truck> References: <20210730112443.23245-1-will@kernel.org> <20210730112443.23245-8-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 17, 2021 at 05:40:24PM +0200, Peter Zijlstra wrote: > On Fri, Jul 30, 2021 at 12:24:34PM +0100, Will Deacon wrote: > > In preparation for replaying user affinity requests using a saved mask, > > split sched_setaffinity() up so that the initial task lookup and > > security checks are only performed when the request is coming directly > > from userspace. > > > > Reviewed-by: Valentin Schneider > > Signed-off-by: Will Deacon > > Should not sched_setaffinity() update user_cpus_ptr when it isn't NULL, > such that the upcoming relax_compatible_cpus_allowed_ptr() preserve the > full user mask? The idea is that force_compatible_cpus_allowed_ptr() and relax_compatible_cpus_allowed_ptr() are used as a pair, with the former setting ->user_cpus_ptr and the latter restoring it. An intervening call to sched_setaffinity() must _clear_ the saved mask, as we discussed before at: https://lore.kernel.org/r/YK53kDtczHIYumDC@hirez.programming.kicks-ass.net Will