Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4420942pxu; Tue, 1 Dec 2020 04:43:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoyFpUibW1fxfwLof9As/pCO0b7adnqc+U3nM5aN4lpbs+wLBOY4rimJBPuidOCyQZI9Kw X-Received: by 2002:a17:906:a899:: with SMTP id ha25mr2785280ejb.203.1606826633161; Tue, 01 Dec 2020 04:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606826633; cv=none; d=google.com; s=arc-20160816; b=DPkZu1JE7pRbQC7anKz6Low+8lUq0LCvbD8P2qITkKEaqbNvVszLFFRJVs9CAIpyQa mNBcFxbV9tSMk5ZvFa34rcI1UOTdevRnpdANZ11nPffH1sAyN8AISbTMpoC8GHgGYQnN MBxZDJrcT9NG3njzvF6bJfZAheh/Y9/nKdryZzPcvIDeaxbAnGcZiBtq6ElFcXtQKecP 91jVL7Mrf84cF0zk64kJ8jVuhuv+0guH72zl3hiERgBwYE7qFjFGL3HGhN2bY1ykblRa bveVApqBhurE4jyWQSLtPrjp45e/cKkksjw/Qf4b2IrherQ/3JZ+xFetBRH1JiOCEcBu BpUg== 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=lBUww53RFhoSaA4q+roaei0e4iCTcYgJXrbA2ztPW1s=; b=Na48HAJBxsIZZG+ZoaCFiKvJbmdzX7Qwc4Z9DjkihzkjaXG9pWqYW/TGPZX41HVQi4 /vloDpG6VQt8zi9dA/pVwsiUUHDfKmIWe2qzPUu/tDfZ67KQ/pe8Vrn1ncEVpxfFVKhn FhNNySo6l6EAogGBUvLFgzOuHTspzWpnIZH3UKPuREnWIE2DzJY/pyM7jGD5lcYAi6aR ZoqcA2BVoiWxGTFjkLpB8lDhbwFxGAJhjC/gAfJaHa6l3OkTPdZxT/muRHq11HbKMCl5 nnFZWNqG9i3R1gz22FI6u3sqWV7XvQepCshvfavdYUZpsJXSA8XFoLKkbUWOeve4uIQg ftxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=V4UhIUVR; 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 t19si851869eju.318.2020.12.01.04.43.30; Tue, 01 Dec 2020 04:43:53 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=V4UhIUVR; 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 S1728623AbgLAMik (ORCPT + 99 others); Tue, 1 Dec 2020 07:38:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbgLAMij (ORCPT ); Tue, 1 Dec 2020 07:38:39 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDE08C0613CF for ; Tue, 1 Dec 2020 04:37:53 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id v14so2512129wml.1 for ; Tue, 01 Dec 2020 04:37:53 -0800 (PST) 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=lBUww53RFhoSaA4q+roaei0e4iCTcYgJXrbA2ztPW1s=; b=V4UhIUVR2V1Ts6TfWAjd3Xk02gdycLDzXgLKwUvsYOCK3WXCsjGTifjGfsUD2SLFr5 v4pdCtNjSfhH6lqdkxSv/sK+K3SmbVydOb/PHVBJYlIca6EzsIL1FsjlsyG3HTh3vNen G/YCDDpD9p9IIpIM6AnIAuwRylLQ6cJEDsLxkrZctPaFeW6MEx7eod3nzNbxaTsHIkMb CKgcLS0dtMfSwHNl2ewGNobaxAEU2+YFS8OvEF7vQhyhhMcrwP9EjvDRE6gmp3eXySOE yuISy+nLTfZ0p+NuMpsJI6/gYvhJSBN6FcOQMRaqbpyuOXXcKbgllp5u0gqe93rM78db GDfw== 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=lBUww53RFhoSaA4q+roaei0e4iCTcYgJXrbA2ztPW1s=; b=bhU5LQP38OWLIh+4Cq0u3vtg9w+fHJgApiu/Y1qD3CXqlClhASKjWqyemLM+UbNITt l0chRDYm6LS65a4huf10AruWLrnm/11Bg4Pu2oTi02RbZRnnoXJKfdsclUx+0+jNrtK3 9FtZfuLWRCz//x8/H+NObqnzldAWE22qxrI+iUgWxJDd/0kvx1iCCIW3d1+0m/3bFdJu MfXMZYw1c3hQMoPDeFBacXZtOZL0Y4eZ+OMvFQVL+1SKo3HuOLWQV9HdgfDhtdGhFagv KY2843yxBboAH+vr+C7CmTPwSXms6AnZiDlhxBUXIvofSYOCSYfFcmauElYIcDUjL8nf uIXg== X-Gm-Message-State: AOAM5334DNGeMQvro6ZTK0Y56ZOA7sCYn10Pybyx8Wo6PdT6lVoVIZmB hLLJpIsMI2Qj9s5jIhXErsjMJA== X-Received: by 2002:a7b:c05a:: with SMTP id u26mr2471062wmc.159.1606826272146; Tue, 01 Dec 2020 04:37:52 -0800 (PST) Received: from google.com ([2a00:79e0:d:210:f693:9fff:fef4:a7ef]) by smtp.gmail.com with ESMTPSA id 21sm3147147wme.0.2020.12.01.04.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 04:37:51 -0800 (PST) Date: Tue, 1 Dec 2020 12:37:48 +0000 From: Quentin Perret To: Qais Yousef 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: <20201201123748.GA1896574@google.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> <20201201115842.t77abecneuesd5ih@e107158-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201201115842.t77abecneuesd5ih@e107158-lin.cambridge.arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 01 Dec 2020 at 11:58:42 (+0000), Qais Yousef wrote: > 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. Yeah but again, we need this to work for existing apps. Just killing it basically means we have no support, so that doesn't work for the use case :/ > > 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? Problem is, we _really_ don't want to keep a big CPU in the background cpuset just for that. And even if we did, we'd have to deal with hotplug. > > > > 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. I see this differently, e.g. if you affine a task to a CPU and you hotunplug it, then the kernel falls back to the remaining online CPUs for that task. Not pretty, but it keeps things functional. I'm thinking a similar kind of support would be good enough here. But yes, this cpuset mess is the part of the series I hate most too. It's just not clear we have better solutions :/ > > > > 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 personally had no issues with that patch, but as per Peter's original reply, that's "not going to happen". Will's proposal seems to go one step further and tries its best to honor the contract with userspace (by keeping the subset of the affinity mask, ...) when that can be done, so if that can be acceptable, then be it. But I'd still rather keep this simple if at all possible. It's just my opinion though :) Thanks, Quentin