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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 2AEE4C433DB for ; Fri, 15 Jan 2021 13:24:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B4E4023358 for ; Fri, 15 Jan 2021 13:24:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4E4023358 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 344698D0173; Fri, 15 Jan 2021 08:24:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CC798D0162; Fri, 15 Jan 2021 08:24:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BB408D0173; Fri, 15 Jan 2021 08:24:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) by kanga.kvack.org (Postfix) with ESMTP id 01B408D0162 for ; Fri, 15 Jan 2021 08:24:11 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C02CA1E07 for ; Fri, 15 Jan 2021 13:24:11 +0000 (UTC) X-FDA: 77708077902.07.act68_0115a9f2752f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 9F81C1803F9A2 for ; Fri, 15 Jan 2021 13:24:11 +0000 (UTC) X-HE-Tag: act68_0115a9f2752f X-Filterd-Recvd-Size: 4697 Received: from gentwo.org (gentwo.org [3.19.106.255]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 13:24:10 +0000 (UTC) Received: by gentwo.org (Postfix, from userid 1002) id 84E73400CD; Fri, 15 Jan 2021 13:24:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 821BA3F293; Fri, 15 Jan 2021 13:24:10 +0000 (UTC) Date: Fri, 15 Jan 2021 13:24:10 +0000 (UTC) From: Christoph Lameter X-X-Sender: cl@www.lameter.com To: Marcelo Tosatti cc: Alex Belits , "tglx@linutronix.de" , "pauld@redhat.com" , "linux-mm@kvack.org" , "frederic@kernel.org" , "willy@infradead.org" , "peterz@infradead.org" , "akpm@linux-foundation.org" , Juri Lelli , Daniel Bristot de Oliveira Subject: Re: [RFC] tentative prctl task isolation interface In-Reply-To: <20210114193430.GA149907@fuller.cnet> Message-ID: References: <20201117180356.GT29991@casper.infradead.org> <20201117202317.GA282679@fuller.cnet> <20201127154845.GA9100@fuller.cnet> <87h7p4dwus.fsf@nanos.tec.linutronix.de> <12ddb629555590cfd41db5b10854d95c1f154e24.camel@marvell.com> <20210113121544.GA16380@fuller.cnet> <20210114193430.GA149907@fuller.cnet> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 14 Jan 2021, Marcelo Tosatti wrote: > > How does one do a oneshot flush of OS activities? > > ret = prctl(PR_TASK_ISOLATION_REQUEST, ISOL_F_QUIESCE, 0, 0, 0); > if (ret == -1) { > perror("prctl PR_TASK_ISOLATION_REQUEST"); > exit(0); > } > > > > > I.e. I have a polling loop over numerous shared and I/o devices in user > > space and I want to make sure that the system is quite before I enter the > > loop. > > You could configure things in two ways: with syscalls allowed or not. Well syscalls that do not cause deferred processing like getting the time or determining the current cpu should be ok to use. And I already said that I want the system to quiet down and allow system calls. Some indication that deferred actions have occurred may be useful by f.e. resetting the flag. > 1) Add a new isolation feature ISOL_F_BLOCK_SYSCALLS (to block certain > syscalls) along with ISOL_F_SETUP_NOTIF (to notify upon isolation > breaking): Well come up with a use case for that .... I know mine. What you propose could be useful for debugging for me but I would prefer the quiet down approach where I determine when I use some syscalls or not and will deal with the consequences. > > > Features that I think may be needed: > > > > F_ISOL_QUIESCE -> quiet down now but allow all OS activities. OS > > activites reset flag > > > > F_ISOL_BAREMETAL_HARD -> No OS interruptions. Fault on syscalls that > > require such actions in the future. > > Question: why BAREMETAL ? To disinguish it from "Realtime". We want the processor for ourselves without anything else running on it. > Two comments: > > 1) HARD mode could also block activities from different CPUs that can > interrupt this isolated CPU (for example CPU hotplug, or increasing > per-CPU trace buffer size). Blocking? The app should fail if any deferred actions are triggered as a result of syscalls. It would give a warning with _WARN > 2) For a type of application it is the case that certain interruptions > can be tolerated, as long as they do not cross certain thresholds. > For example, one loses the flexibility to read/write MSRs > on the isolated CPUs (including performance counters, > RDT/MBM type MSRs, frequency/power statistics) by > forcing a "no interruptions" mode. Does reading these really cause deferred actions by the OS? AFAICT you could map these into memory as well as read them without OS activities. "Interruptions that can be tolerated".... Well that is the wild west of "realtime" where you can define how much of a time slice is "real" and how much can be use by other processes. I do not think that any of that should come into this API.