Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5233846pxv; Wed, 28 Jul 2021 06:22:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhCbXB8JTs3XsEjSpyHWwKVU1hE941fW2fARLSKrom8o+GDuHUwdWUjZXBkN3XMAWBTKNc X-Received: by 2002:a92:db44:: with SMTP id w4mr13510764ilq.101.1627478568186; Wed, 28 Jul 2021 06:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627478568; cv=none; d=google.com; s=arc-20160816; b=OUX+pNZJx+mFw+uLBzrJQLF7HiDtSAt88w/FPCaz/upc53XLPkIhABjoeAAnT1Atdn 8wmt3DhUl7wtMPHB8GbA0Q+K4TtLmMjRs7QoMPIn1Oo5arsWTpM3Hqn2sWxo7trYPwRU 5EEybFfxFYh7j7oUS/gVDRi/6enLuYJiJ8uPWlQlc6/kUoA2onus/JrsZ7Ii7II7n3C3 y9kTUIGIF0F4pQUY/Ypyl2dKNJolNkTYxuWp1om/kk0Y9BXynXPmO7UU0WJLr52CHz8M z9wnSz5YBpE6e+3vJSVQdhNpZWaQHP+Qx2E779BsELDQVHvyDmEKJ73aOMnp+p5lzL8H 8yiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=0Qll4aU4ay39Nu3DuLdbZ97Ai6peAuRkVSv78NV49Zk=; b=mqR5UlwoCBga7iiWv/9MYgCrUd0nPMgRayLwFvAconySwsntlOoEhjPTVJnm9VlXoc TkpIsWPlupMB/9lCzuDc+tmPocJ/+JL3CrPRTpTmDk+tA3I57vvNxY/4oG/ntaFYgfLk alRZaBfJrAvA/lYbv9wFmi9JWqMPKFW8WkRndszhCv8YsLj8ICL/IpROGzg94duAosuL y4anU9X8aNKxPjmQMsXMwLK0nXJt3VStYIaT1nDE6A/+ZLu//bDyX/Wyq0DmynA8VD9W Et60Xtg3Vx8+jK/cPH+UtTE82dxMr4Zm9YGC1kKLAscWsZnyXfzacaUId+elqgBAvV3w +T8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mvr6UlW3; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si7207335jat.98.2021.07.28.06.22.35; Wed, 28 Jul 2021 06:22:48 -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=@redhat.com header.s=mimecast20190719 header.b=Mvr6UlW3; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236216AbhG1NVu (ORCPT + 99 others); Wed, 28 Jul 2021 09:21:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27717 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235324AbhG1NVt (ORCPT ); Wed, 28 Jul 2021 09:21:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627478507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0Qll4aU4ay39Nu3DuLdbZ97Ai6peAuRkVSv78NV49Zk=; b=Mvr6UlW3I8iLSf0rSwcVsDK5lGxv/JiA5tzB6fJf05vANl/F8r8m28EbaTlKVDVfZCU8R4 02xioAEhWjEE4xzv3BtieXRyvGPIi1NmjJO+121/DacXUSdn9qsAWGwiiKDeSe3xBkVbf9 qg1phVIUWI/fTa02mH6Ee0fKvW1I7b4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-b6nadfueOLuM-hC-zJRplw-1; Wed, 28 Jul 2021 09:21:46 -0400 X-MC-Unique: b6nadfueOLuM-hC-zJRplw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 373D5801AE3; Wed, 28 Jul 2021 13:21:45 +0000 (UTC) Received: from fuller.cnet (ovpn-112-3.gru2.redhat.com [10.97.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E2221007606; Wed, 28 Jul 2021 13:21:37 +0000 (UTC) Received: by fuller.cnet (Postfix, from userid 1000) id BCE7B416F5D2; Wed, 28 Jul 2021 10:16:10 -0300 (-03) Date: Wed, 28 Jul 2021 10:16:10 -0300 From: Marcelo Tosatti To: nsaenzju@redhat.com Cc: Frederic Weisbecker , linux-kernel@vger.kernel.org, Nitesh Lal , Christoph Lameter , Juri Lelli , Peter Zijlstra , Alex Belits , Peter Xu , Thomas Gleixner Subject: Re: [patch 1/4] add basic task isolation prctl interface Message-ID: <20210728131610.GA11900@fuller.cnet> References: <20210727103803.464432924@fuller.cnet> <20210727104119.551607458@fuller.cnet> <7b2d6bf91d30c007e19a7d2cbddcb2460e72d163.camel@redhat.com> <20210727110050.GA502360@fuller.cnet> <20210727130930.GB283787@lothringen> <20210727145209.GA518735@fuller.cnet> <20210727234539.GH283787@lothringen> <20210728093707.GA3242@fuller.cnet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 01:55:33PM +0200, nsaenzju@redhat.com wrote: > Hi Marcelo, > > On Wed, 2021-07-28 at 06:37 -0300, Marcelo Tosatti wrote: > > On Wed, Jul 28, 2021 at 01:45:39AM +0200, Frederic Weisbecker wrote: > > > On Tue, Jul 27, 2021 at 11:52:09AM -0300, Marcelo Tosatti wrote: > > > > The meaning of isolated is specified as follows: > > > > > > > > Isolation features > > > > ================== > > > > > > > > - prctl(PR_ISOL_GET, ISOL_SUP_FEATURES, 0, 0, 0) returns the supported > > > > features as a return value. > > > > > > > > - prctl(PR_ISOL_SET, ISOL_FEATURES, bitmask, 0, 0) enables the features in > > > > the bitmask. > > > > > > > > - prctl(PR_ISOL_GET, ISOL_FEATURES, 0, 0, 0) returns the currently > > > > enabled features. > > > > > > So what are the ISOL_FEATURES here? A mode that we enter such as flush > > > vmstat _everytime_ we resume to userpace after (and including) this prctl() ? > > > > ISOL_FEATURES is just the "command" type (which you can get and set). > > > > The bitmask would include ISOL_F_QUIESCE_ON_URET, so: > > > > - bitmask = ISOL_F_QUIESCE_ON_URET; > > - prctl(PR_ISOL_SET, ISOL_FEATURES, bitmask, 0, 0) enables the features in > > the bitmask. > > > > - quiesce_bitmap = prctl(PR_ISOL_GET, PR_ISOL_SUP_QUIESCE_CFG, 0, 0, 0) > > (1) > > > > (returns the supported actions to be quiesced). > > > > - prctl(PR_ISOL_SET, PR_ISOL_QUIESCE_CFG, quiesce_bitmask, 0, 0) _sets_ > > the actions to be quiesced (2) > > > > If an application does not modify "quiesce_bitmask" between > > points (1) and (2) above, it will enable quiescing of all > > "features" the kernel supports. > > I think this pattern of enabling all by default might be prone to subtly > breaking things. The reasoning behind this pattern is that many latency sensitive applications (as far as i am aware) prefer "as few interruptions as possible, no interruptions is preferred". In that case, the pattern makes sense. > For example, let's say we introduce ISOL_F_QUIESCE_DEFER_TLB_FLUSH, this will > defer relatively short IPIs on isolated CPUs in exchange for a longer flush > whenever we enter the kernel (syscall, IRQs, NMI, etc...). Why the flush has to be longer when you enter the kernel? ISOL_F_QUIESCE_DEFER_TLB_FLUSH might collapse multiple IPIs into a single IPI, so the behaviour might be beneficial for "standard" types of application as well. > A latency sensitive > application might be OK with the former but not with the latter. Two alternatives: 1) The pattern above, where particular subsystems that might interrupt the kernel are enabled automatically if the kernel supports it. Pros: Applications which implement this only need to be changed once, and can benefit from new kernel features. Applications can disable particular features if they turn out to be problematic. Cons: New features might break applications. 2) Force applications to enable each new feature individually. Pros: Won't cause regressions, kernel behaviour is explicitly controlled by userspace. Cons: Apps won't benefit from new features automatically. --- It seems to me 1) is preferred. Can also add a sysfs control to have a "default_isolation_feature" flag, which can be changed by a sysadmin in case a new feature is undesired. Thoughts?