From patchwork Wed May 31 14:59:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alice Ryhl X-Patchwork-Id: 10112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2958904vqr; Wed, 31 May 2023 08:19:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7zUXy8Xigok05xVk96ZTTw+bIqJ0WE33/TTbMY+tXnFyQ4pyv/FZgTh3YszEm9669Ghb/E X-Received: by 2002:a05:6a00:2488:b0:643:980:65b with SMTP id c8-20020a056a00248800b006430980065bmr7169280pfv.2.1685546372748; Wed, 31 May 2023 08:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685546372; cv=none; d=google.com; s=arc-20160816; b=seIf+fE6KkNDkyfkn7D2YU5hgQJS62nlTq55tin0uHTRjFTKWIH/ay674GucbIfmcI 2G3Lh5FV+CU5ltVBQ3lJNTOYa4jXsxbxSDQM0uRp8P4vCOEdQeVKOt1d0apmne1149Hd ofbX4XpqNxBWSqELwHcfgB4LA91O04it8WYW5kVaFCDhz+FdxW/tE9xB2nNKiPXESMJ7 t7ZliOnJY0TgmpG3FgymUaYjxnCVzsLFTf2kJVZLjL0+VpgwF4fDlgG/wGvbgQyFyMs9 sXJRrN93zw8Chgb1OY1bStkj+/qjhl2fC3gfEB5jDTomEVOU15KSat/ywXN32lSmHv2T pvXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=kgt3lW2r0aoY0DDLcZTyq/QALzXXToKg0VwThNVsEZs=; b=n6rZ4vduh/S3Hcd3UiYyNn59eqWZ1t7lpM9BmbriTdUFkaMV6vbYYY9ADMNvmYJ+ra CG7B/upm3MeFY6zxEbJDP26+/TVL6VSESLgrzxn8j04FeYRMBkS6OlTD9+OHIYHcv6ST J9LWIVT0Dg51+FpE+lcTeNxNUNVwGqhZgczdtYNWSQiL5l89KeqJlKxayYNxKafkQRfF tgR1PSKc5+Y5Z41FbnNHIap1ZhgxuxV8GloIJLS08JGTuaF2jjxHfreBYjAFUgi1HYmL 5YFTLcHKZ1PWwANYo2kLx99MalRV01ho8rI3LUe5X96Vl2mC3d4gZ+QAQFBrclfklPe9 7hjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=DxCZiH1E; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a656a82000000b0053fadb32e27si890391pgu.437.2023.05.31.08.19.20; Wed, 31 May 2023 08:19:32 -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=@google.com header.s=20221208 header.b=DxCZiH1E; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231640AbjEaPAO (ORCPT + 99 others); Wed, 31 May 2023 11:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231501AbjEaPAM (ORCPT ); Wed, 31 May 2023 11:00:12 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C463410E for ; Wed, 31 May 2023 08:00:10 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5659c7dad06so121917837b3.0 for ; Wed, 31 May 2023 08:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685545210; x=1688137210; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=kgt3lW2r0aoY0DDLcZTyq/QALzXXToKg0VwThNVsEZs=; b=DxCZiH1EJ6GTCeR7M1xZCCD83a49cOiQ9TFOb2cpTE+xJykFniGsMxkSKaNxVhgrie 1ZUAUK64KCNds1oQP+SCgoYSGdYMWl4o7suvBgY/fiRhtcgkzNsNtzRN+NWwpIus8zx3 Vae/ZhynetGaQPIjblP8vLMJRXOMjpcH629xoRqz8t5E2fEZrJswrNEjr6nEe/aHzUTs RF6bxBNTe+6jyJyimjvXZ6/h8o3aJ6JwIzR0C63FS93ayeG0tDJuGhpRYKeAhQSqums1 4tURIQ+m9vlVvRiXXfNzi4B2tWPJXtV8fwHUDZ2/v9rrUFsoB2tqZmw9E2ZE5l2J9MU8 roSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685545210; x=1688137210; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kgt3lW2r0aoY0DDLcZTyq/QALzXXToKg0VwThNVsEZs=; b=Jf0t8p0gyW2apWyfZugEzysCpYMR3uKUPBrH3UiV1pP6AKB1M5QN0MDAbduerV6ERk 49RRyH3rCDqE9L981QAoXMEnSkqhN2Ua5AFzERvXYMAygSzL+8agrsxSpJzt1Zl3d4qG 77j4NvoeoO8e195dK4G0mGG136yj2BNytxHAzqc9dYNSqOyZM4MgDBJQ/fZSH3aVUelp iD2v+7JCpIwyR6y7CF+hJiZxP2/50CLdwyAvu2LIZRke0z8SWgcxWlccB6PUA7GfDnUq Dgb1H4vgXisQqK2goKRB9xpqxQPGl9FuN1ZVpdziYMGhp/2R//VNsSByAjQ/iuFHlOn+ Hqtw== X-Gm-Message-State: AC+VfDwbHHW+FigKuTSWUjokhLugR/BsLJcC5S+sPkrzE0Lsb6vxZVkd tx95mDqEllTq0g1O4+HpdLCEkaUmNoNlLsY= X-Received: from aliceryhl.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:6c8]) (user=aliceryhl job=sendgmr) by 2002:a81:ae05:0:b0:565:9f59:664f with SMTP id m5-20020a81ae05000000b005659f59664fmr3434986ywh.6.1685545210063; Wed, 31 May 2023 08:00:10 -0700 (PDT) Date: Wed, 31 May 2023 14:59:35 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230531145939.3714886-1-aliceryhl@google.com> Subject: [PATCH v3 0/4] Update thread safety markers From: Alice Ryhl To: rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Alice Ryhl , Ingo Molnar , Peter Zijlstra , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org, patches@lists.linux.dev X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED, USER_IN_DEF_DKIM_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?1767423473379365810?= X-GMAIL-MSGID: =?utf-8?q?1767423473379365810?= In Rust, the `Send` and `Sync` traits are used to mark in what ways a specific type is thread safe. In this patch series, I add some missing thread safety markers and improve the documentation related to them. This change will let you compile some code that would currently fail to compile even though it doesn't actually violate any thread safety rules. You can find a definition of what these marker traits mean at [1]. Changes since v2: * Removed "for example" as suggested in [2]. * Added Reviewed-by annotations from v2 review. [1]: https://stackoverflow.com/a/68708557/1704411 [2]: https://lore.kernel.org/all/20230523165027.71600b4b.gary@garyguo.net/ Alice Ryhl (4): rust: sync: reword the `Arc` safety comment for `Send` rust: sync: reword the `Arc` safety comment for `Sync` rust: specify when `ARef` is thread safe rust: task: add `Send` marker to `Task` rust/kernel/sync/arc.rs | 12 +++++++----- rust/kernel/task.rs | 10 ++++++++-- rust/kernel/types.rs | 13 +++++++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) base-commit: ac9a78681b921877518763ba0e89202254349d1b