Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5084385pxv; Wed, 28 Jul 2021 02:41:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3kblkflOsb+nsJ6VAc7MW3XaSFfLmMpM9dYYvg0ze7tHg/9fhNOehDgMubsl0+sWpElvt X-Received: by 2002:a5e:9743:: with SMTP id h3mr12391881ioq.52.1627465303157; Wed, 28 Jul 2021 02:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627465303; cv=none; d=google.com; s=arc-20160816; b=ZEkxt7VRd7jHjwYuVwSfyoL6RId0ObjadzZ2tCAo4QMrPg9wDvvjcdPDHZnRjvm1yz QfDtgaUj20mc54gFLiIGzNGCuhQpp+cQynZ18JudUld6v+J328yzG+LPdXWuwl3fa4RN 56CA6T5sbCcvJp7aTAaWOcOad0ZwLX87wFE8hWzmfX8rGs8ka51cLtphB1EjlZ+gbc0h mi+FhfLs+r9thb3y7f3ytkf6B80FZMQfdJm5A9GzdDUgoBsPWSGLPgSMBRUtwFP8OXy/ CZh/DTH9ow58NQwUO8aD7bxkhrMkFnkUhy+F/0EZujWrDzxfqwvbVwPkD5MqP3hbccK5 h7xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QWYajFnJCJzmpzKrv7hbKbuFIci/pVSRegRGjTua7O0=; b=reWYgcDXpt3Wf/94TbmytzhyADJYN2Ukz9vbGWZOByZj6Znwo1N+WdPOeJCurmYHJF wtUA7kjkT3ffn118QdSQrJ8mPOQVgMaR90fX/GBGSuANyskCY/3rAMdlf46apULHZA2h U4k06DrDuiIrlYFHwzBQ6wPbCKpZgr71ZghphmJRmbuAT1E2zmwQxblPeSIlq/3Z5m2u v7w/LxMyV7ZUpRG5otJQZp3CUo9+iRphF6Lua7YyPt3fGGKu/AYIPtld9tFqxOA+n5Gr VQ3lvPzKQDKBfUyobx67fQTEqa1fx4DMR7jxJ5AEBVBYHIBT6XzJ/VKZGc1TOwEAu52p +y3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=l4TDshnG; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si6291902jan.83.2021.07.28.02.41.32; Wed, 28 Jul 2021 02:41:43 -0700 (PDT) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=l4TDshnG; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235764AbhG1Jjp (ORCPT + 99 others); Wed, 28 Jul 2021 05:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235679AbhG1Jjo (ORCPT ); Wed, 28 Jul 2021 05:39:44 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89B9DC061757 for ; Wed, 28 Jul 2021 02:39:42 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id m20-20020a05600c4f54b029024e75a15716so1225798wmq.2 for ; Wed, 28 Jul 2021 02:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QWYajFnJCJzmpzKrv7hbKbuFIci/pVSRegRGjTua7O0=; b=l4TDshnGaVaNrCBGz8USyiAQ/yncxv/XGJmIm83yOaQhEbSiv6MgQ0QJVX9q8GoIxo rRKVKidZIyrdNbEUfzBB6KYwXo6V60OvulGJsQoVAsRds6rVkfV7lg0Xwo9OkZAxp5+k Jj/8TXE6FWFG22hxnjLOEze2aPxuayJTXsAz9uTxpmMf8dWwKKCjRRlfNutNKjVyhhYy mvhGCWeu4Lbe9UjToKlMPmPCRV/G/wF7sZtLthWg7rw/bc+Qe6vl2wZ9qlrS4RW2lwPf PxjmtuPKeoORfhmF0R+9Ra6qbReEZvmemcqMyO6o2h4q14x4ZjR5DagzwqTdV9KFqPs4 QngA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QWYajFnJCJzmpzKrv7hbKbuFIci/pVSRegRGjTua7O0=; b=IcaVLExcqgNTfi+2PjdGwEXdeta5wVNnpDwzm5aWMyy6p+Jgz+5TyNe7NheSzi/0AB 0LAKg9OvMvRmpC3ttsgQRTVijS0tWxJAsrGRNGzAQdZR97euRbxCizkYn40Z74NpZ9R3 LFGVTjM0Htx8J91eJiDwGtebz6+CxLg0SMLRe6pdb2L7l/rex8EjqeZ6KUrCuWspQ+6n iXSTXDQhfVqgydMM/7oxoITASpVI5lWSMswJoJxoR9OY3NaIRm5vxLzRw+SCAJWfG/M1 40bulOsjEqiODuuRvgxRr7H1x6WmD/cGr5NQYMlA0dvZnRuusAC4UZvA0SXo/9m+T0oV ai7w== X-Gm-Message-State: AOAM530N7hD2Gbh6Hba/g72dg6ksvblqpaIKq0b0rdLA+e39tGdcl7ZH K11mrJ0PBIFhT/Pqke/nLJDjmA== X-Received: by 2002:a1c:4e10:: with SMTP id g16mr8507098wmh.66.1627465180964; Wed, 28 Jul 2021 02:39:40 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:20cb:dab7:97bc:c682]) by smtp.gmail.com with ESMTPSA id m14sm5943663wrs.56.2021.07.28.02.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 02:39:40 -0700 (PDT) Date: Wed, 28 Jul 2021 10:39:38 +0100 From: Quentin Perret To: Juri Lelli Cc: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] sched: Don't report SCHED_FLAG_SUGOV in sched_getattr() Message-ID: References: <20210727101103.2729607-1-qperret@google.com> <20210727101103.2729607-3-qperret@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 28 Jul 2021 at 11:12:03 (+0200), Juri Lelli wrote: > Hi Quentin, > > On 27/07/21 11:11, Quentin Perret wrote: > > SCHED_FLAG_SUGOV is supposed to be a kernel-only flag that userspace > > cannot interact with. However, sched_getattr() currently reports it > > in sched_flags if called on a sugov worker even though it is not > > actually defined in a UAPI header. To avoid this, make sure to > > clean-up the sched_flags field in sched_getattr() before returning to > > userspace. > > > > Signed-off-by: Quentin Perret > > --- > > kernel/sched/core.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 2d9ff40f4661..d8f489dcc383 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -7535,6 +7535,7 @@ SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr, > > kattr.sched_priority = p->rt_priority; > > else > > kattr.sched_nice = task_nice(p); > > + kattr.sched_flags &= SCHED_FLAG_ALL; > > Maybe we can do this in the previous patch so that it's kept confined to > deadline bits? That works too, it just felt like this could happen again if we start using non-standard flags outside of deadline for any reason at some point in the future. But no strong opinion really. Cheers, Quentin