Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp144148pxu; Tue, 1 Dec 2020 08:00:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1+u0K/mhGV1VwOWwNQ6Q7yEeVXUC3XIzSPg3ctzW3w0P4WBEnuIg+wEOHRGkM1F6RtRfd X-Received: by 2002:a05:6402:134a:: with SMTP id y10mr3675554edw.144.1606838412066; Tue, 01 Dec 2020 08:00:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606838412; cv=none; d=google.com; s=arc-20160816; b=xH9tOxvTrD4NWT1uXpcFF/81GhBNTlMHHXhGLJ3HlX980B/YtqO3sBtyN8xQcx2lU+ 0waR8UgRdOID+v7llcWCxXKtZnd8415IOV9uvYmdnOO7/5q3A5zXQodZzxF20UHcs/MW B1I7HRVFHAdxCjHgtfXe6WjvncfSHSeicFylv7SYcDlWL6x3w+qVt9c3ybrEf/J/yjS+ t9plm+IZs1STmC4oTDbHZCQMegEzygzmcsk+NQ37jGjVub9NCydTtMg73924OJ+gBXPK FPXDHUlivLUJZBd9SL8s2QYhfxiH2obPglakWDf+2LqPirwHCtQ4GrZ1YvCr9EYbxItx U24A== 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=yVk5KHBR+Mddw8rCuMxzgEChumqmL4eB1KqK5P0hH5E=; b=e0Uf6ReyqpAKXR0MHyo+oscnfQPnJWPYOmmA2ybVPqNQZwks/AP5fPIuwC2iUuEDPA bjidW9zfZvfgUcQbEZGKPPj8pP8Fc3Oed5wtwkEX8JbflS7kWKCGFDEnmrvwctaip3zx kHNgB4DjZWJEna8GpXrWCfHSv2FfDMPgJGEs9L+6WxbrGu64dOZi7XxpGDba1opgRQjB DrK1fLicJOOO4maMthFfLEjyuzMDXTdFHAD2EwVdeu2JX3Ikmo1+fmEK8V7Z5R/56+ot ttN58U2XNeROzuCFu1JXTEz1sx1JdWbxb55cqJzc//b8V2jse+6mmPCdZCI3pbNLAGRk d/wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UlFHk+22; 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 y7si128758ejw.546.2020.12.01.07.59.47; Tue, 01 Dec 2020 08:00:12 -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=UlFHk+22; 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 S2389229AbgLAP5l (ORCPT + 99 others); Tue, 1 Dec 2020 10:57:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389233AbgLAP5k (ORCPT ); Tue, 1 Dec 2020 10:57:40 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92B3EC0613CF for ; Tue, 1 Dec 2020 07:56:54 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id 23so3372903wrc.8 for ; Tue, 01 Dec 2020 07:56:54 -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=yVk5KHBR+Mddw8rCuMxzgEChumqmL4eB1KqK5P0hH5E=; b=UlFHk+22AOC3daNQPBuWa/WMNZh1Aip8NACSrVS7zIMCaANpB+k7HZYxRY/53FozG5 ejfoB5rw0FQIm/4x7tHSlcIZytPxDItsRVPnGd7qrBKCVtkYSq3bsbEn0wieqpSLza+M J5P4tX7HOYIWiNwkc4h0gs+0qMY8CyEKgTY2ZohmAZWJCjwibOoXG3Xw/aJhrnDLH0d7 tQoRF5o1yotOhTPfrhiXDDTIjYasLy0/3zw0CBtfa6Gkeoj3PrvpzNMJFmcYlueLw16X nRRH8FJcCl4/tElozP8dUn1P8pWTY4XIxbjDnPtR6vv4TP9yNf4vlMmJq4ISdt0lBAxl vvgQ== 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=yVk5KHBR+Mddw8rCuMxzgEChumqmL4eB1KqK5P0hH5E=; b=DBdE2cjgS0xEXSb/+pxMZ0b4vu8vWmmDCCy/HZK49lsIDihMDGIBB2lpCA2Y63m1v6 kqeZPbh0DE0l9G5kiQKOvs+otRgb5aJ1xZLPDSScb0UBYICrYOLnwsCrkmtR13IwADBg JthnWaXGsd7PM9v7ywSCtb9hymAp+k7DDNStCi39SYPc8vRZzpAyiuXGu0PWutt5+ER9 VN/9AqyUXmGfuGj3bfHHrTcFOhVv8epYkt1SYzUp6QTn1OhZwXrktWmsdJwT3PIfQaXf V0+HIvPb+ait3rX6IP19WQMIUkAU08s7Nj6pbKXNLwCTT6YQtjgZ2sKqVyTSAdSHDawM sRCA== X-Gm-Message-State: AOAM530f+f4OApSz9Dsur5zK/GUTL/9vl1qTIMvi45x2Y5nHRJE29cdm hcvnOGuIuwAo5cE4kMV8kJyw/iRtWmVHrg== X-Received: by 2002:adf:e788:: with SMTP id n8mr4738634wrm.84.1606838213044; Tue, 01 Dec 2020 07:56:53 -0800 (PST) Received: from google.com ([2a00:79e0:d:210:f693:9fff:fef4:a7ef]) by smtp.gmail.com with ESMTPSA id n4sm376363wmc.30.2020.12.01.07.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 07:56:52 -0800 (PST) Date: Tue, 1 Dec 2020 15:56:49 +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: <20201201155649.GB1914005@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> <20201201123748.GA1896574@google.com> <20201201141121.5w2wed3633slo6dw@e107158-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201201141121.5w2wed3633slo6dw@e107158-lin.cambridge.arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 01 Dec 2020 at 14:11:21 (+0000), Qais Yousef wrote: > AFAIU, OEMs have to define their cpusets. So it makes sense to me for them to > define it correctly if they want to enable asym aarch32. > > Systems that don't care about this feature shouldn't be affected. If they do, > then I'm missing something. Right, but there are 2 cases for 32 bit tasks in Android: 1. 32 bit apps; these are not an issue, the Android framework knows about them and it's fine to expect it to setup cpusets accordingly IMO. 2. 64 bit apps that also happen to have a 32 bit binary payload, and exec into it. The Android framework has no visibility over that, all it sees is a 64 bit app. Sadly we can't detect this stupid pattern, but we need these to remain somewhat functional. I was only talking about 2. the whole time, sorry if that wasn't clear. With that said, see below for the discussion about cpuset/hotplug. > We deal with hotplug by not allowing one of the aarch32 cpus from going > offline. Sure, but that would only work if we have that 32 bit CPU present in _all_ cpusets, no? What I'd like to avoid is to keep a (big) 32 bit CPU in the background cpuset of 64 bit tasks. That would make that big CPU available to _all_ 64 bit apps in the background, whether they need 32 bit support or not, because again we cannot distinguish them. And yeah, I expect this to be not go down well in practice. So, if we're going to support this, a requirement for Android is that some cpusets will be 64 bit only, and it's possible that we'll exec into 32 bit from within these cpusets. It's an edge case, we don't really want to optimize for it, but it needs to not fall apart completely. I'm not fundamentally against doing smarter things at all, I'm saying we (Android) just don't _need_ smarter things ATM, so we may want to keep it simple. My point in the previous message is, if we're accepting this for exec, a logical next step could be to accept it for cpuset migrations too. Failing the cgroup migration is hard since: there is no guarantee the source cpuset has 32 bit CPUs anyway (assuming the exec'd task is kept in the same cpuset), so why bother; userspace just doesn't know there are 32 bit tasks in an app and would keep trying to migrate it to 64 bit cpuset over and over again; you could end up with apps being stuck halfway through a top-app->background transition where some tasks have migrated but not others, ... It's a bit of a mess :/ > For hotplug we have to make sure a single cpu stays alive. The fallback you're > talking about should still work the same if the task is not attached to > a cpuset. Just it has to take the intersection with the > arch_task_cpu_possible_cpu() into account. Yep, agreed, there's probably room for improvement there. > For cpusets, if hotunplug results in an empty cpuset, then all tasks are moved > to the nearest ancestor if I read the code correctly. In our case, only 32bit > tasks have to move out to retain this behavior. Since now for the first time we > have tasks that can't run on all cpus. > > Which by the way might be the right behavior for 64bit tasks execing 32bit > binary in a 64bit only cpuset. I suggested SIGKILL'ing them but maybe moving > them to the nearest ancestor too is more aligned with the behavior above. Hmm, I guess that means putting all 32-bit-execd-from-64-bit tasks in the root group in Android. I'll try and check the implications, but that might be just fine... Sounds like a sensible behaviour to me anyways. Thanks, Quentin