Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp130513pxb; Wed, 8 Sep 2021 19:37:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJd7Wy+LP/kUoGWvCpGDKBQLfABvE16GPPpa+oEK051/V7vBZjsj1iN+U0/2Shh0lcEAjX X-Received: by 2002:a5e:d80c:: with SMTP id l12mr640568iok.120.1631155021380; Wed, 08 Sep 2021 19:37:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631155021; cv=none; d=google.com; s=arc-20160816; b=RDVsHBw+gbYAw9tFHe2NBcpk5E5fCy+EixCyEbUJVClRGhS5KKpbBM7g9t8HAnDCjH Tf8g5Txx2Xv8fwv7JY4QpkV3V9c1JmI/w+BM87s76kV4tXKgYzIIhDoyFIU5hWi6BEfG ty1W/00Sul0ax/I88/SgOH5u7ISZCF5EXl3xdI2C+NAI/K+AB///T+BfOk3KbzxaBwqU GStj0X3T/IIDWdj8gUSRbbSBiB+4Me7kjvLtuoTtw8l/uMkf+0NgzA/3rR80nzBj+ag6 scRXwFXmi7N6pWwF+UjIJWGICUL5Z0G9pAIqQN3mGZuHAewpgCiX/bBgfUfmEeD0XjfM 6QWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gvLyT4+7Aiymn6gXzNE4oKTpQfZnma/CF9vdVIrLCj0=; b=u9tkT6QDCAzcz/fyrMXmlDEymxLok+tWATNsN1cPLroTTHR4Al6q0ka5OzziQ6tSBh nI21qNeBLPasz29c1qtFNzdvugbmsofMLtzozWo5jUtOcZX8ufi67NlI4m2kHKXXxwDY /bpUsTnAieE0d3hEUTrS8fgklXx6FKvoMr1FZHn2jgnDGqMB0yIVLRcKb202LLwX4cQe h3dNKZNAMyTuz0N7wr2Y2ISDhPQeu0SKECc040atfGRN6flLV6s7lNnQaQugrc44YNrb aDbV6TDWq+SLJhByWwqBI209fwyZZpYi6nAd5S7ke9mrAt2Akk/8mohgA20t0RWPp1gg 0RKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=loBPUFiJ; 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 w13si507451ilu.26.2021.09.08.19.36.49; Wed, 08 Sep 2021 19:37:01 -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=@google.com header.s=20210112 header.b=loBPUFiJ; 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 S232144AbhIIBR6 (ORCPT + 99 others); Wed, 8 Sep 2021 21:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349086AbhIIBRy (ORCPT ); Wed, 8 Sep 2021 21:17:54 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92F51C061575 for ; Wed, 8 Sep 2021 18:16:45 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id f18so212143lfk.12 for ; Wed, 08 Sep 2021 18:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gvLyT4+7Aiymn6gXzNE4oKTpQfZnma/CF9vdVIrLCj0=; b=loBPUFiJ17CJ4ZdjUsFhVmUZ8Cg018uO8pv3jVcFNEjIZVzht/g5phznAS6jMzVM7u 1b960PykAURWK6R1WWuzYsw1WW/rLiiB1NxXWRiQWasxgYExBxCr0g++4OVjJSsjh3SR Atd5BJHlbFWfJE2Q91fduLBIh2jw6EkyO6aLkrNX5AOHzzR7mGXDFiy3btCQndztlZgc wMW4aso3DZSP1xVwh53RCmETvnWLjxKzqi4PG3MtfJ/mBoRtUYpvQt2QP9HbAAok0SgT j4GFArFfPaSYyAc0q8fUct1EMmVfzoYa1W89crrw9OsK17O+labUFu/nJOKRHk8tso4a mcuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gvLyT4+7Aiymn6gXzNE4oKTpQfZnma/CF9vdVIrLCj0=; b=s7rjVS5aw2pCgWhZXqYhwewK8CgaqufsU4TGyi4M65owCEWZO13KKKnpF33yTgsZpW atnEQdniD9zvL2qDAZ163/AeRqV0orMqPHc0j+sS5Yh0+bv8BT3Elz03pIJ0YglM9GN3 q46yO3sH5T3cflGaBSau+xEs2szaTNKcPf5AobX1f6IhjQ026bQF8xGsJuRKqM4omZqS uFfLfqg6h9i9QW/hURpGhvTreHqIl4Yc/cs+5+myL4WGyfQCHa/6HVLuKUHHPh/vRQaY /i6EcxMA9+n4BwoPh4tIujkO+/GDqlWNZ5Cjbedivffu4yQfBkA7N2uiuyF0mC6QKJt8 XTig== X-Gm-Message-State: AOAM531piG7AubvOWMdfXxvXXFCwKbiwI2bE+Zc1lxvNJtIVa3JC4pug 1r0QGebMyPpKfdU2TuGProcVPqSe6GsS7WoQhooOPw== X-Received: by 2002:a05:6512:695:: with SMTP id t21mr365696lfe.157.1631150203757; Wed, 08 Sep 2021 18:16:43 -0700 (PDT) MIME-Version: 1.0 References: <20210908184905.163787-1-posk@google.com> <20210908184905.163787-3-posk@google.com> In-Reply-To: From: Jann Horn Date: Thu, 9 Sep 2021 03:16:17 +0200 Message-ID: Subject: Re: [PATCH 2/4 v0.5] sched/umcg: RFC: add userspace atomic helpers To: Peter Oskolkov Cc: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Paul Turner , Ben Segall , Peter Oskolkov , Andrei Vagin , Thierry Delisle Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 9, 2021 at 1:38 AM Jann Horn wrote: > On Wed, Sep 8, 2021 at 8:49 PM Peter Oskolkov wrote: > > Add helper functions to work atomically with userspace 32/64 bit values - > > there are some .*futex.* named helpers, but they are not exactly > > what is needed for UMCG; I haven't found what else I could use, so I > > rolled these. [...] > You of course won't be able to simply traverse userspace pointers in > such a situation, only access the specific userspace object that > you've prepared beforehand, but luckily it looks like: > > * idle_server_tid_ptr is only accessed in get_idle_server() > -> which is used from process_waking_worker() > -> which runs in sleepable context > * idle_workers_ptr is accessed from: > -> enqueue_idle_worker > -> which is also used from process_waking_worker() Ah, I guess I got that wrong: process_waking_worker() is sleepable, but it might be holding the mmap lock, so it can't fault, right? Which means this would actually be problematic...