Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3534567pxb; Mon, 24 Jan 2022 11:37:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/Wbi41b/R5KimpYxQ/Ql2ulEhM9uyGr6BsuiZnhDApKn3pMztDsE1oGDJZnmME2t2sGrC X-Received: by 2002:a17:90b:1a88:: with SMTP id ng8mr3395699pjb.144.1643053043260; Mon, 24 Jan 2022 11:37:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643053043; cv=none; d=google.com; s=arc-20160816; b=rIP3AWz7IXHq8h2lf4R6jaSamNY3ZWha9yyupP+UBWnJDPyji+a//dMS6JSL8YJ03t BqBTY+7I2HF51FFpQr/pbgNdjZIk4EsaeG6hL1eIgCrON+R3eLqOnlUJ5Aox65H4NDNN 1Ai2lrLTReB/alqmXAs69Rh75OVig1B90tKJemga6Cpwk13LJ/MlAOiDM+uue2k50nx0 Ay/J6636aFgkK1e6jh+c+lHEXgGQtIoxzJ6xuCVUVGqfYBpwO9WPrdhUr/7bx0S/si+W jA/J5O0mJaVD1ZuBV2/wRTJMI3V1asM74oI1DSOEIXcai+VWiqaMEoa5rnByS8VTimmF wNqA== 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=6k8LAK7tMRkW1TbeMgEK2fdsQgEWFo9/JaDK8LRdPXQ=; b=i1uSA4+M/aAZN++pTAbn3NRCYtaM9C61VC52F3evNWvdVNIVEs3hcxMFTUwbCOP/za dNvaTEbnzaG6OH6mOmyUoffVTTc5BLFipGG/o2KpxDhUimXWhhPe+jNFrHcrzAFVGdEy b8z3PP9y0MPIDGWr7C6kW1vsbHUseVhVCpblhmEhk0TDUjOsn2hpQ5dyqZcNsuO6YT5t gBPICAQRauIUC5gIntAsvWH6uIrZVEqo0tuOSYfhxH1U9uVAHJPudF2oGtM6PZhgFakc 8VoxPscnymzXRc0G3yLOzvAcbXC+OW2eNfKq3OzX/vyOQ0WrDmDF7HAInyls6LBFvC8a mDeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=omnMlmPu; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si14590113pgr.721.2022.01.24.11.37.10; Mon, 24 Jan 2022 11:37:23 -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=@infradead.org header.s=casper.20170209 header.b=omnMlmPu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243843AbiAXQok (ORCPT + 99 others); Mon, 24 Jan 2022 11:44:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241172AbiAXQoi (ORCPT ); Mon, 24 Jan 2022 11:44:38 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F8BAC06173B; Mon, 24 Jan 2022 08:44:38 -0800 (PST) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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