From patchwork Fri May 19 23:07:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beau Belgrave X-Patchwork-Id: 9612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp20094vqo; Fri, 19 May 2023 16:13:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6FdiPyCqhmXUfXudLahu6vti2VP1xytbJ/CBBiQV+txVwEemC3YypF9epJx7pzQYwJsPVW X-Received: by 2002:a05:6a00:a21:b0:646:9232:df6 with SMTP id p33-20020a056a000a2100b0064692320df6mr5209930pfh.33.1684538016042; Fri, 19 May 2023 16:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684538016; cv=none; d=google.com; s=arc-20160816; b=0I6zwMI+4orWZKnzP76vIx2YLU6D8WGmUEMNdZAl5fwzo47aTq7aljVh0T9z4YFQZC OT/59oDobe/r5aTXC/CuUNW79VWuSPfW2I8eEKGKzCmbjRc32JgA7DfBA6KFn06bV3Bt EUkN26PgjVq4P58ny0UO0u/tqNIqIzWR8J3VlxLNt37CFX875w92UmLyIRjKhjzTn1Sz JKf8YIh9YaXKTUX8fJ80sXoRjavmCpzZFnWwDUYGGwzUsCHIizNm40yqo8OJNKTIgl4q Nr6yKlWIAUJoVHOdjkvnySVtrKPSpjcvi3hUSQbdZ+yTT0Z/mvwPHqj33LbwIrR5SHrQ uBZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=YH2G13bl35OJzy0HLtezwie5ahZIQ6Oyhln0vPhVRMw=; b=WJo7DyCaVEwnUEu4LUyMe1eEXwbWL9PMAms6+dhw2udBH7yuDxyKUDnizWhKaXNLSP +plh2FrP3UbXmwQxr+IzrkHs2o0YqXSMvh3rdIgvq1K+AHOW5ACj8NKfyqN0WbsRftiC DBtGfjyoIEZryQgGShYqvBBFmYOcrT9JP4S4QdeKmRiF3Woheyxv+93trETpsxk2OIhE vHP5YXP6a01tMUDKFw2xK0A3EdlonRsA4jeFwJ8QNqYyLDOK8qpXiVZs1D2RSg9HrAGb HCpzshprVsr+MlLP0QgAlrfBJt5JVd4u/I7h0BsFQmUU7vBWM2v0lqS7Ima5ZeLlTwup 3Log== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=mMlldXyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f66-20020a625145000000b0064d295ca592si385812pfb.69.2023.05.19.16.13.01; Fri, 19 May 2023 16:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=mMlldXyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231739AbjESXI2 (ORCPT + 99 others); Fri, 19 May 2023 19:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjESXIZ (ORCPT ); Fri, 19 May 2023 19:08:25 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8A4F210D; Fri, 19 May 2023 16:08:24 -0700 (PDT) Received: from W11-BEAU-MD.localdomain (unknown [76.135.27.212]) by linux.microsoft.com (Postfix) with ESMTPSA id D94F520FB609; Fri, 19 May 2023 16:08:23 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D94F520FB609 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1684537704; bh=YH2G13bl35OJzy0HLtezwie5ahZIQ6Oyhln0vPhVRMw=; h=From:To:Cc:Subject:Date:From; b=mMlldXyDx146kS0ujbBDy91nXrwkKG7oiFnnrYgllip80ECOveLoh6WECwgYrkFxk CpQRZqPLpv51MpF6i+DoQwvSlfFIf8R6RtLvCGmKmsn51LsSwaT5A+5D4fIpCNcWhv vU/rwsiFp3uac+QqAkualOHxO9R4BTWfEB6kO/K4= From: Beau Belgrave To: rostedt@goodmis.org, mhiramat@kernel.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, torvalds@linux-foundation.org, ast@kernel.org Subject: [PATCH v3 0/4] tracing/user_events: Use non-RCU context for enabler writes Date: Fri, 19 May 2023 16:07:37 -0700 Message-Id: <20230519230741.669-1-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766366134595604150?= X-GMAIL-MSGID: =?utf-8?q?1766366134595604150?= Currently when events are enabled/disabled a top level mm enumeration is done in a non-RCU context, however, the enablers are still in a RCU-context. Each enabler is updated via user_event_enabler_write() which uses pin_user_pages_remote(). This function can reschedule and should not be used from a RCU-context, which this series addresses. There was also feedback given that some of the code was confusing and needed further comments and field renames, especially for links. I think having this feedback will help others contribute to this code easier, so I am grouping this into a single series to address this together. NOTE: Series is based on the for-next branch of the following tree: git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git Change history V3: Use Linus's patches to more completely solve this issue. Added comments and renamed fields as suggested by Linus to ensure easier reasoning over the code for everyone. V2: Remove break statement that prevents more than 1 enabler in MM for same event (rare, but possible). Beau Belgrave (2): tracing/user_events: Rename link fields for clarity tracing/user_events: Document user_event_mm one-shot list usage Linus Torvalds (2): tracing/user_events: Split up mm alloc and attach tracing/user_events: Remove RCU lock while pinning pages include/linux/user_events.h | 3 +- kernel/trace/trace_events_user.c | 97 +++++++++++++++++++++----------- 2 files changed, 67 insertions(+), 33 deletions(-) base-commit: 3862f86c1529fa0016de6344eb974877b4cd3838