Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp500311pxf; Thu, 25 Mar 2021 08:19:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEqnut3T+rOk5C+UDRU95+9LQGDcTeqPo8EctkFB02UZ4qYzR4ubqYFL1DOrYFW2UMh71D X-Received: by 2002:a17:906:14d0:: with SMTP id y16mr10115914ejc.242.1616685589844; Thu, 25 Mar 2021 08:19:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616685589; cv=none; d=google.com; s=arc-20160816; b=HnDEWmFkEvi+g+ghCISlECIGoLs7vQhcnfQC/3C5oQRwFmaM3FiIggnDcaTSIhoIVo JqtuSXvJGwBWxICy4RBpXF/+UuXo4sqjXxCwCLR6HdcKIYbM23JtLe2Um51tT/HrFL5x b43emFcI70xf8/66NRBHgSWeFYxQUaLeL1Jc9x76XNn3ebhX9rtSkaV9LzFtERVeKU8P wrJWaYMibF3r+uNi18Pfvwfvs9XIhNlbmi9vmg96Kojh6SkBDU/BQLaNC6ihci0nyzYa JKz7IPkUuE0Ptl/qxRTDlSI+C/07JhzJVPRYP4qKKJOpWQ3d1BZENaHtx1cuh/v63R2F TuTw== 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=EPhq8X0xhYyGxzLncqihu1TYBV4JibjwwPfDPM36hqE=; b=DvrX8fcIn4r0K8nfecV/5fqsH96RYJwobdaG7QoXQs/IpoXdxPyYsNJY+dPtUXHW7d ki48W1HusDdJCGsmwJt/XGMvE5yQyG3RP84MFEomtJ3GftDUc9UWjsfMzYQaCHD/+woV zGA14Ch1UazhaT8edJk73HRgJL/k90nViHUP4ut00TQ/O5nqCKIboio1fzE5GWZ2zjB9 D76UOgFgs8WefgKKvkO/exaYUT5nc6oALWL/aCfyCltDRKY1O2LJHoIjQ2UtqFq8se1y qyV5HS7gqVpNeYlxMako42jDQPBbfbDytkhsvzJUTisheECGlYldhm0MSUEIgrvgGHoQ 4Xug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=us6aw6Ol; 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 dg1si4446352edb.610.2021.03.25.08.19.26; Thu, 25 Mar 2021 08:19:49 -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=20161025 header.b=us6aw6Ol; 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 S231215AbhCYPSE (ORCPT + 99 others); Thu, 25 Mar 2021 11:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbhCYPRx (ORCPT ); Thu, 25 Mar 2021 11:17:53 -0400 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C20A5C06175F for ; Thu, 25 Mar 2021 08:17:52 -0700 (PDT) Received: by mail-ot1-x330.google.com with SMTP id g8-20020a9d6c480000b02901b65ca2432cso2266289otq.3 for ; Thu, 25 Mar 2021 08:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EPhq8X0xhYyGxzLncqihu1TYBV4JibjwwPfDPM36hqE=; b=us6aw6OlE2KUAf0pq5BNsKs9E6wrt4m3eXA2HFHqv/r8VcNJ6/mx4SdkGM9uuW4L6a +I2iVx2sCO/gqvw5jOi6vpBWS8dwLBXOm4Z5RvXhmh80RKrAKyddL19nPGerUC1QPXJE e+Er+Q5cjde6I3pqM1+9UYXq8g180VxArqzpFP6yD4SqRFZU8zhWXm/K2aKOSanl8LLh H+pid5FLXkTBWbxX2zyS1dfTe+DtUjQ8XF1vtyJF4LaS2UHcyX/d904OtShVOOFTakoO JNtpuTW9wkPdFnhUu4wJrpYgkorzxjiqE7r91RJnPtgRZxXdy5b0XuLjA4YuoEWVk/xJ fOFw== 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=EPhq8X0xhYyGxzLncqihu1TYBV4JibjwwPfDPM36hqE=; b=JjecQC6IvVCdINGFzN6i4oWufAt54OrrTgDXobjyy1fEkdigHAKQTjMRgJjuwxHIwc VjlN4yst1DNr5qBKrHAmu25QPxO0DWxos7myPzm7BZw70GAqcoJpe4v3jftyI8xCKlC6 c0I4jm2i9UyMGCMol4Q0N+G+4B6eHqsdrXm+QCEDNzFKadBIvVwS/Kwt7c3iLjS/yiMj RwPbXIiAqEwKfsclhu8ueP7ftXUFIChKHUWwv2mRfXskwj3Ks9ZKiY7v+Dl8IQvuuOIA mT093lD4QmtpdNhA8zvobb+SaoU2mwaCgyhaMgZMP3csZdz1/ioQgvZzswf1oX7rkVw6 DQhw== X-Gm-Message-State: AOAM530J/0yIoOqW0uXbbcN+AgyN5NVDh0cxV+1pX8B17179xbVWl0QP rIuh778+NMfqjg5XXy4GOBVXp+ntOacQsWeMBv31bw== X-Received: by 2002:a05:6830:148c:: with SMTP id s12mr8235464otq.251.1616685471859; Thu, 25 Mar 2021 08:17:51 -0700 (PDT) MIME-Version: 1.0 References: <20210324112503.623833-1-elver@google.com> <20210324112503.623833-8-elver@google.com> <20210325141820.GA1456211@gmail.com> In-Reply-To: <20210325141820.GA1456211@gmail.com> From: Marco Elver Date: Thu, 25 Mar 2021 16:17:40 +0100 Message-ID: Subject: Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP To: Ingo Molnar Cc: Dmitry Vyukov , Peter Zijlstra , Alexander Shishkin , Arnaldo Carvalho de Melo , Ingo Molnar , Jiri Olsa , Mark Rutland , Namhyung Kim , Thomas Gleixner , Alexander Potapenko , Al Viro , Arnd Bergmann , Christian Brauner , Jann Horn , Jens Axboe , Matt Morehouse , Peter Collingbourne , Ian Rogers , kasan-dev , linux-arch , linux-fsdevel , LKML , "the arch/x86 maintainers" , "open list:KERNEL SELFTEST FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 25 Mar 2021 at 15:18, Ingo Molnar wrote: > > * Dmitry Vyukov wrote: > > > On Wed, Mar 24, 2021 at 3:05 PM Marco Elver wrote: > > > > > > On Wed, 24 Mar 2021 at 15:01, Peter Zijlstra wrote: > > > > > > > > One last try, I'll leave it alone now, I promise :-) > > > > > > This looks like it does what you suggested, thanks! :-) > > > > > > I'll still need to think about it, because of the potential problem > > > with modify-signal-races and what the user's synchronization story > > > would look like then. > > > > I agree that this looks inherently racy. The attr can't be allocated > > on stack, user synchronization may be tricky and expensive. The API > > may provoke bugs and some users may not even realize the race problem. > > Yeah, so why cannot we allocate enough space from the signal handler > user-space stack and put the attr there, and point to it from > sig_info? > > The idea would be to create a stable, per-signal snapshot of whatever > the perf_attr state is at the moment the event happens and the signal > is generated - which is roughly what user-space wants, right? I certainly couldn't say how feasible this is. Is there infrastructure in place to do this? Or do we have to introduce support for stashing things on the signal stack? From what we can tell, the most flexible option though appears to be just some user settable opaque data in perf_event_attr, that is copied to siginfo. It'd allow user space to store a pointer or a hash/key, or just encode the relevant information it wants; but could also go further, and add information beyond perf_event_attr, such as things like a signal receiver filter (e.g. task ID or set of threads which should process the signal etc.). So if there's no strong objection to the additional field in perf_event_attr, I think it'll give us the simplest and most flexible option. Thanks, -- Marco > Thanks, > > Ingo