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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 83C32C48BDF for ; Thu, 10 Jun 2021 10:20:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 657466100A for ; Thu, 10 Jun 2021 10:20:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbhFJKWf (ORCPT ); Thu, 10 Jun 2021 06:22:35 -0400 Received: from foss.arm.com ([217.140.110.172]:56194 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbhFJKWe (ORCPT ); Thu, 10 Jun 2021 06:22:34 -0400 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 8A12CD6E; Thu, 10 Jun 2021 03:20:38 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 051873F694; Thu, 10 Jun 2021 03:20:35 -0700 (PDT) From: Valentin Schneider To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , 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 , kernel-team@android.com Subject: Re: [PATCH v8 11/19] sched: Allow task CPU affinity to be restricted on asymmetric systems In-Reply-To: <20210607225202.GB8215@willie-the-truck> References: <20210602164719.31777-1-will@kernel.org> <20210602164719.31777-12-will@kernel.org> <87zgw5d05b.mognet@arm.com> <20210607225202.GB8215@willie-the-truck> Date: Thu, 10 Jun 2021 11:20:33 +0100 Message-ID: <87eedac972.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/06/21 23:52, Will Deacon wrote: > On Fri, Jun 04, 2021 at 06:12:32PM +0100, Valentin Schneider wrote: >> On 02/06/21 17:47, Will Deacon wrote: >> > + /* >> > + * Forcefully restricting the affinity of a deadline task is >> > + * likely to cause problems, so fail and noisily override the >> > + * mask entirely. >> > + */ >> > + if (task_has_dl_policy(p) && dl_bandwidth_enabled()) { >> > + err = -EPERM; >> > + goto err_unlock; >> > + } >> > + >> > + if (!cpumask_and(new_mask, &p->cpus_mask, subset_mask)) { >> > + err = -EINVAL; >> > + goto err_unlock; >> > + } >> > + >> > + /* >> > + * We're about to butcher the task affinity, so keep track of what >> > + * the user asked for in case we're able to restore it later on. >> > + */ >> > + if (user_mask) { >> > + cpumask_copy(user_mask, p->cpus_ptr); >> > + p->user_cpus_ptr = user_mask; >> > + } >> > + >> >> Shouldn't that be done before any of the bailouts above, so we can >> potentially restore the mask even if we end up forcefully expanding the >> affinity? > > I don't think so. I deliberately only track the old mask if we've managed > to take a subset for the 32-bit task. If we end up having to override the > mask entirely, then I treat it the same way as an explicit affinity change > (only with a warning printed) and don't then try to restore the old mask -- > it feels like we'd be overriding the affinity twice if we tried to do that. > Put in this way, it does make sense to me. Thanks! 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=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 5C8ABC47094 for ; Thu, 10 Jun 2021 10:22:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2C44E613C0 for ; Thu, 10 Jun 2021 10:22:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C44E613C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DeXPS6x/QF4Vf/97a82nkMPvtwA0SwBiykMWFZ+7ZEk=; b=v4DNqcwyELfq6u txy+Nf3Ior/23F1vyT3nbXJEzyAhwdEZ6E02tZkm1HUTM7g6DTZzn9kAShSlW0BQDOsrxlQZz8wd8 1VOrb0+q+jmnZDDJrBP2Q7FAHzhgp8dly+uirHqtpPDO10NCRkl1uCs1hqMhdYyqmo6t7sEc79XFF QQiS/P0EZHDT+zJWNpfU5YBpZ/t9cAu7bMo4PkD2JrFdvyZvyZP72Wp9io9kMqEvq7uSn3soA/Wdc 97OEJ/Fof1y8KafEfGb2ExBge4ZIhxGTpArHOX8gnd72PUauws/aIbe+LC/rMcd91WV9Bw0MXgX4v iOIFr10o0AUtXXArZF8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrHnq-000PqG-B9; Thu, 10 Jun 2021 10:20:46 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrHnl-000PoZ-HK for linux-arm-kernel@lists.infradead.org; Thu, 10 Jun 2021 10:20:43 +0000 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 8A12CD6E; Thu, 10 Jun 2021 03:20:38 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 051873F694; Thu, 10 Jun 2021 03:20:35 -0700 (PDT) From: Valentin Schneider To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , 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 , kernel-team@android.com Subject: Re: [PATCH v8 11/19] sched: Allow task CPU affinity to be restricted on asymmetric systems In-Reply-To: <20210607225202.GB8215@willie-the-truck> References: <20210602164719.31777-1-will@kernel.org> <20210602164719.31777-12-will@kernel.org> <87zgw5d05b.mognet@arm.com> <20210607225202.GB8215@willie-the-truck> Date: Thu, 10 Jun 2021 11:20:33 +0100 Message-ID: <87eedac972.mognet@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210610_032041_628077_ED2B1D9F X-CRM114-Status: GOOD ( 21.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 07/06/21 23:52, Will Deacon wrote: > On Fri, Jun 04, 2021 at 06:12:32PM +0100, Valentin Schneider wrote: >> On 02/06/21 17:47, Will Deacon wrote: >> > + /* >> > + * Forcefully restricting the affinity of a deadline task is >> > + * likely to cause problems, so fail and noisily override the >> > + * mask entirely. >> > + */ >> > + if (task_has_dl_policy(p) && dl_bandwidth_enabled()) { >> > + err = -EPERM; >> > + goto err_unlock; >> > + } >> > + >> > + if (!cpumask_and(new_mask, &p->cpus_mask, subset_mask)) { >> > + err = -EINVAL; >> > + goto err_unlock; >> > + } >> > + >> > + /* >> > + * We're about to butcher the task affinity, so keep track of what >> > + * the user asked for in case we're able to restore it later on. >> > + */ >> > + if (user_mask) { >> > + cpumask_copy(user_mask, p->cpus_ptr); >> > + p->user_cpus_ptr = user_mask; >> > + } >> > + >> >> Shouldn't that be done before any of the bailouts above, so we can >> potentially restore the mask even if we end up forcefully expanding the >> affinity? > > I don't think so. I deliberately only track the old mask if we've managed > to take a subset for the 32-bit task. If we end up having to override the > mask entirely, then I treat it the same way as an explicit affinity change > (only with a warning printed) and don't then try to restore the old mask -- > it feels like we'd be overriding the affinity twice if we tried to do that. > Put in this way, it does make sense to me. Thanks! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel