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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 3F6B3C433B4 for ; Tue, 11 May 2021 22:15:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 935286191C for ; Tue, 11 May 2021 22:15:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 935286191C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=pernos.co Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0224C6B0036; Tue, 11 May 2021 18:15:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F14D26B006E; Tue, 11 May 2021 18:15:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8DA36B0070; Tue, 11 May 2021 18:15:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id B974A6B0036 for ; Tue, 11 May 2021 18:15:35 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 796028136 for ; Tue, 11 May 2021 22:15:35 +0000 (UTC) X-FDA: 78130357830.21.6E7FAE3 Received: from mail-vk1-f173.google.com (mail-vk1-f173.google.com [209.85.221.173]) by imf17.hostedemail.com (Postfix) with ESMTP id CF829407F8FE for ; Tue, 11 May 2021 22:15:29 +0000 (UTC) Received: by mail-vk1-f173.google.com with SMTP id v188so2808112vkf.5 for ; Tue, 11 May 2021 15:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pernos.co; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9APnGG9XDlJhvDOfUIsq0WVU3gMNJ2g3qgJEUxydNUg=; b=I3q6I778Ko853XpTutbwmhvj2DKUu5ahO1ZPdz/ndvEFPNrXNJXKgpsDjpzdSwS3nR ruVb+G6BDMDvMnC5REh4QVHaVDV/X2cEvZ/p7Q+wSh6jB48ZKgm+dsaDTDBbDvo219+F QDVjRFr2vafsSx2o7fVZH0F4kYuSSVnK3e6uI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9APnGG9XDlJhvDOfUIsq0WVU3gMNJ2g3qgJEUxydNUg=; b=ZuqKoVNUSzwcuaFbojUDbZa+9OmYmoQ8B3JUSFvRXHjT9oYTaxziNm6qtqAjtLtHq+ j30phOD1SfKc2G72pWhcBgC8251nbBNnGjOEBO5rd38HzET/rNC+HTv0GAmcbZjucFds 8KrnkBsRhkSCjjeaj3DD9bYVKd8Fya/5RocpEyXV9nGdzmx3l7YQZQt8j2oahsZdsHUf +LRMRcMLITbL892PBCKB7PmPY7ejbj3mkolrYkGmn5ekWE05CEIky2/JdMix78eLvS9E Xg/vcQZu6slxvW763bEcKOPYvf2cRWgz/QpArEhNwEJxif6ZqGH3kcBWlQPzWDmeQ9Z0 BwJQ== X-Gm-Message-State: AOAM530sfk6ZnK7WLuMMyuMgJaVXcAzVZRTqhJLeSqXt5IRd8VobdAPq Y4BNvjQnsoWTPMNra4MdF7j01JPjqPJjYPJt X-Google-Smtp-Source: ABdhPJzBaH1wzWRorM3WNEMC97rDTnZHD7OR4I0irMam9vQjpqKvtQdzUAAAsPXM34BS+cxbbxjxng== X-Received: by 2002:a1f:2504:: with SMTP id l4mr25012257vkl.5.1620771334074; Tue, 11 May 2021 15:15:34 -0700 (PDT) Received: from mail-vk1-f173.google.com (mail-vk1-f173.google.com. [209.85.221.173]) by smtp.gmail.com with ESMTPSA id q76sm2377154vka.25.2021.05.11.15.15.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 May 2021 15:15:33 -0700 (PDT) Received: by mail-vk1-f173.google.com with SMTP id 31so3195820vkl.12 for ; Tue, 11 May 2021 15:15:32 -0700 (PDT) X-Received: by 2002:a1f:fe0b:: with SMTP id l11mr5646538vki.24.1620771332590; Tue, 11 May 2021 15:15:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Robert O'Callahan" Date: Wed, 12 May 2021 10:15:21 +1200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Userspace notifications for observing userfaultfd faults To: Axel Rasmussen Cc: Andrea Arcangeli , Andrew Morton , Hugh Dickins , Peter Xu , Ingo Molnar , Linux-MM , LKML , Kyle Huey Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=pernos.co header.s=google header.b=I3q6I778; dmarc=pass (policy=quarantine) header.from=pernos.co; spf=none (imf17.hostedemail.com: domain of roc@pernos.co has no SPF policy when checking 209.85.221.173) smtp.mailfrom=roc@pernos.co X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CF829407F8FE X-Stat-Signature: m6dttkb79bccydhjmc57axjrp1gza5xw Received-SPF: none (pernos.co>: No applicable sender policy available) receiver=imf17; identity=mailfrom; envelope-from=""; helo=mail-vk1-f173.google.com; client-ip=209.85.221.173 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620771329-996543 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 Wed, May 12, 2021 at 6:12 AM Axel Rasmussen wrote: > Is some combination of bpf and kprobes a possible solution? There are > some seemingly relevant examples here: > https://github.com/iovisor/bpftrace/blob/master/docs/tutorial_one_liners.md > > I haven't tried it, but it seems like attaching to handle_userfault() > would give similar information to perf_count_sw_page_faults, but for > userfaults. That would probably work in some cases, but as Kyle said that requires privileges and currently rr can run unprivileged (if you set perf_event_paranoid to 1 or less) and usually does. Also, AFAIK, kprobing handle_userfault would not be a stable ABI. Rob