Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp410197pxu; Tue, 1 Dec 2020 14:34:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTDeJtX4QCSUWvOVz6rTVLbcOZHK5njfKjggabA4px4fvmHu9AkX0sG9btL17YrhlJ2pNc X-Received: by 2002:a17:906:e907:: with SMTP id ju7mr5298967ejb.518.1606862086892; Tue, 01 Dec 2020 14:34:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606862086; cv=none; d=google.com; s=arc-20160816; b=QIg46xlQrvwVRtQyIGM9KNBjqZPm2seq2PrcXUtMIicWnywQ4wqBperX+1P6+8QM+f +UbDTqge4Zw26XsnenOqRwL98rO0xpzf7cuhBibB/9TmpCo4zu/C8ckgMLN8cPzNo1eO Uv8sogsvrYiwsGCeOW8fDkJaY4PibldCTKrDB2sdlaLeYzlnrAoN9sn83lh8o5iHBYV2 +AJReSIxaOvQJYH2f1QmonaQ4Iu/XzCoycCFnUnVkwYAvq7JRpWrqFqZn8yvBJrnIZfm zqE/3Ij+UkctvtPRMNTqMenZ21e3mroyLAD23nDUTBE51tuBPltM4qm6KOX9TMRtPwlg bEWw== 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; bh=gxfNwjnrnHI8PzAjbIVMXphsuY8rKOGFlpgEUwxPrqY=; b=n0g2OlqFAKaiKCkW8XNIH49xdt6VOowgDWNgVE1y2l08r1tmwUbvVA0739pCU8VSV6 cD0lFVOkeL0mW0jZQba5Xi1zIbwQ4XBdBnWdsBjBdkatr5JyilVkcQeDxqeJFi6AgMl3 5hIL38oWC4O5cw6Go3IQ17eIw4MyS8Ez4jCto2GzoVVTMRwTBBZr+ETESB4ozi+Rouda SkTuzZLBKcq2XmsQnWydDTgpolyRIjYeDj3gIEnWkH17uw2L39camf3Tn7xi9bvcGf74 RjKs+81LUf6CNm0jLTCj4G3xBdH5Q+NVBBTY3iudkgwHXKa1Hg0KFGRm2mns+lDW/Tvo 4Nrw== 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 c7si844860edr.193.2020.12.01.14.34.24; Tue, 01 Dec 2020 14:34:46 -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 S2390719AbgLAL7d (ORCPT + 99 others); Tue, 1 Dec 2020 06:59:33 -0500 Received: from foss.arm.com ([217.140.110.172]:41540 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389432AbgLAL7c (ORCPT ); Tue, 1 Dec 2020 06:59:32 -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 BEE38101E; Tue, 1 Dec 2020 03:58:46 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (unknown [10.1.194.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8C8D43F718; Tue, 1 Dec 2020 03:58:44 -0800 (PST) Date: Tue, 1 Dec 2020 11:58:42 +0000 From: Qais Yousef To: Quentin Perret Cc: Will Deacon , 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 , Suren Baghdasaryan , Tejun Heo , Li Zefan , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , kernel-team@android.com Subject: Re: [PATCH v4 09/14] cpuset: Don't use the cpu_possible_mask as a last resort for cgroup v1 Message-ID: <20201201115842.t77abecneuesd5ih@e107158-lin.cambridge.arm.com> References: <20201124155039.13804-1-will@kernel.org> <20201124155039.13804-10-will@kernel.org> <20201127133245.4hbx65mo3zinawvo@e107158-lin.cambridge.arm.com> <20201130170531.qo67rai5lftskmk2@e107158-lin.cambridge.arm.com> <20201130173610.GA1715200@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201130173610.GA1715200@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/30/20 17:36, Quentin Perret wrote: > On Monday 30 Nov 2020 at 17:05:31 (+0000), Qais Yousef wrote: > > I create 3 cpusets: 64bit, 32bit and mix. As the name indicates, 64bit contains > > all 64bit-only cpus, 32bit contains 32bit-capable ones and mix has a mixture of > > both. > > > > If I try to move my test binary to 64bit cpuset, it moves there and I see the > > WARN_ON_ONCE() triggered. The task has attached to the new cpuset but > > set_allowed_cpus_ptr() has failed and we end up with whatever affinity we had > > previously. Breaking cpusets effectively. > > Right, and so does exec'ing from a 64 bit task into 32 bit executable > from within a 64 bit-only cpuset :( . And there is nothing we can really True. The kernel can decide to kill the task or force detach it then, no? Sending SIGKILL makes more sense. > do about it, we cannot fail the exec because we need this to work for > existing apps, and there is no way the Android framework can know > upfront. It knows upfront it has enabled asym aarch32. So it needs to make sure not to create 'invalid' cpusets? > > So the only thing we can do really is WARN() and proceed to ignore the > cpuset, which is what this series does :/. It's not exactly pretty but I > don't think we can do much better than that TBH, and it's the same thing > for the example you brought up. Failing cpuset_can_attach() will not > help, we can only WARN and proceed ... I think for cases where we can prevent userspace from doing something wrong, we should. Like trying to attach to a cpuset that will result in an empty mask. FWIW, it does something similar with deadline tasks. See task_can_attach(). Similarly for the case when userspace tries to modify the cpuset.cpus such that a task will end up with empty cpumask. We now have the new case that some tasks can only run on a subset of cpu_possible_mask. So the definition of empty cpumask has gained an extra meaning. > > Now, Android should be fine with that I think. We only need the kernel > to implement a safe fallback mechanism when userspace gives > contradictory commands, because we know there are edge cases userspace > _cannot_ deal with correctly, but this fallback doesn't need to be > highly optimized (at least for Android), but I'm happy to hear what > others think. Why not go with our original patch that fixes affinity then in the arch code if the task wakes up on the wrong cpu? It is much simpler approach IMO to achieve the same thing. I was under the impression that if we go down teaching the scheduler about asym ISA, then we have to deal with these edge cases. I don't think we're far away from getting there. Thanks -- Qais Yousef