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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECC75C433EF for ; Mon, 24 Jan 2022 17:08:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79E816B00AB; Mon, 24 Jan 2022 12:08:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 74F3B6B00AD; Mon, 24 Jan 2022 12:08:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 664BE6B00AE; Mon, 24 Jan 2022 12:08:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id 585496B00AB for ; Mon, 24 Jan 2022 12:08:17 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0F53F181616DA for ; Mon, 24 Jan 2022 17:08:17 +0000 (UTC) X-FDA: 79065813834.06.F690939 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id D5D26A0025 for ; Mon, 24 Jan 2022 17:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6k8LAK7tMRkW1TbeMgEK2fdsQgEWFo9/JaDK8LRdPXQ=; b=omnMlmPu3KuMaCmyP0Tf+sxWCy /lM8WFMNuvRt+OYBaKD5+tKz3VeldzynZERSAAWs8v5ZrVcKxBaQUUkYrfRleX5LQIQBg7Eej1oop 9LVzblXb3ql3Ao1XMzw3R3iN/3vm65nv5bbuGkB3FfD0g/tAGkMStiJFCqdw2NpYEhnxRHfxHYwaQ b5Oors1mFLqYW+Sw+0NvI5dbwrcDlX2omWcnJyhupZHqz9OUZuOcU20IuvUG9RmwPBdYV4ZcajUUU 0Q0NKpe6U/3gY8ZKNCmlLbFq2t5EVedaJZtukmmGhkzb/XPK05DYWeTDhhfl817LzOizwL4qoivyl 1gEAp6nQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC2Ro-000vWm-FM; Mon, 24 Jan 2022 16:44:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id AC13B300B80; Mon, 24 Jan 2022 17:44:03 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 90D492B3A07CB; Mon, 24 Jan 2022 17:44:03 +0100 (CET) Date: Mon, 24 Jan 2022 17:44:03 +0100 From: Peter Zijlstra To: mingo@redhat.com, tglx@linutronix.de, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, x86@kernel.org, pjt@google.com, posk@google.com, avagin@google.com, jannh@google.com, tdelisle@uwaterloo.ca, mark.rutland@arm.com, posk@posk.io Subject: Re: [RFC][PATCH v2 5/5] sched: User Mode Concurency Groups Message-ID: References: <20220120155517.066795336@infradead.org> <20220120160822.914418096@infradead.org> <20220121114758.GF20638@worktop.programming.kicks-ass.net> <20220121151845.GB22849@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: D5D26A0025 X-Stat-Signature: 8mhf4e3qg66cjeuf3gtg1g6g8knu5nef Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=omnMlmPu; spf=none (imf15.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Rspamd-Server: rspam01 X-HE-Tag: 1643044089-285281 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 Mon, Jan 24, 2022 at 03:29:56PM +0100, Peter Zijlstra wrote: > On Fri, Jan 21, 2022 at 04:18:46PM +0100, Peter Zijlstra wrote: > > Something like this, still yuck though. Also still need to write me a > > test for this. > > > > --- a/kernel/sched/umcg.c > > +++ b/kernel/sched/umcg.c > > @@ -232,6 +232,8 @@ static int umcg_update_state(struct task > > /* Called from syscall enter path and exceptions that can schedule */ > > void umcg_sys_enter(struct pt_regs *regs, long syscall) > > { > > + current->umcg_timeout = 0; > > + > > /* avoid recursion vs our own syscalls */ > > if (syscall == __NR_umcg_wait || > > syscall == __NR_umcg_ctl) > > @@ -519,6 +521,7 @@ void umcg_notify_resume(struct pt_regs * > > struct umcg_task __user *self = tsk->umcg_task; > > bool worker = tsk->flags & PF_UMCG_WORKER; > > u32 state; > > + int ret; > > > > /* avoid recursion vs schedule() */ > > if (worker) > > @@ -554,12 +557,17 @@ void umcg_notify_resume(struct pt_regs * > > umcg_unpin_pages(); > > } > > > > - switch (umcg_wait(0)) { > > + ret = umcg_wait(tsk->umcg_timeout); > > Oh how I hate signals... this can get scribbled by a syscall/fault from > sigcontext :/ > > Maybe I can recover the timo argument from the original syscall > pt_regs.. let me try. Urgh, recursive hell... If the signal does *anything* that tickles notify-resume it'll find RUNNABLE and go wait there --- ad infinitum. I need to go cook dinner, I'll prod more at this later