Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp681180lqh; Thu, 28 Mar 2024 12:59:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWOcXFSWXwmiwYHGZiZPePO0bfPyoCBqIKNmcbjWbbiBkLg6vlPaLNYuNiCBBY1zsD9C5EW6ujCo9nnX411UPQbZSq2wteHTDMYsxDPhQ== X-Google-Smtp-Source: AGHT+IE5qfUDF/yHOVd7IfymUUUHjNHLqMwFpoXdrjuyftxLVH3SkFYcE0ofcbCjWPPC7YMSvLk4 X-Received: by 2002:a05:620a:4509:b0:78b:ba77:5df9 with SMTP id t9-20020a05620a450900b0078bba775df9mr4809909qkp.22.1711655942592; Thu, 28 Mar 2024 12:59:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711655942; cv=pass; d=google.com; s=arc-20160816; b=I7GJlLlbCxLkMPp5ONZuxXhd49hA3k0vb/7v95rR0lZX82ogxakmdS7WeizRRBA4O7 zwczQIzkdMm57exE0/tvp7PTGJT8bL5PjaHawf53AjN+1KENSthwqlUQMJ5Li+1XNZYE G9eKZ7R5Aw8HZMTK0LBwxDh1n03M6W7XMK5L76lPYW4wsGSA+uFSbR2JEOBuh0TEBa5K 0Nd0b6iyoZ7ml3+iEOLr0xoxmzs7uS+I6jqkN/4YofKMqQYCKOV7fvLEF+XMO+ekQ5iB TtLvKVh8/m+ROBEvp5FtyWO7Rv9jXMiAPvju4xJYvjaYujczh3rRobO/Dsd0uQB8kvxI +WDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3onkuNTqsbsPIhsygl1fro8dFk+/knTOJGgy1+clLaE=; fh=wXkNu2nP14e40Sex9njePrjdyCp1BwDk5hRqYSuiyVw=; b=Xex92LWB5ZlEM+wg222jsPhEyXFAhjSzGPNssGfXuf6X9+fdiqk3XWUMKb9+RrpcUi zh4KdwJZ/ia+XAXd0lG7V0lM40UMwLi/v94l2c0VSI93qoDug6c+GJDnD843uIRQp/Cd JsVbLYsCdKy4/i+BdMHOzNGCCcitJXIp/S+Q9ChsY6z+pmTg5OlRdjEoJsjBBerP7Xyl bvGvs8Mx949dnAl4mYKp58IJJoedSPAfksRSicTWWvzyrnYSJHw1KvBwscpyOgBtkCmd 8k9NRVcc9o9sQpmfIOTjMqyKwa/7UBo8Y4Z0BIzG2d2T9Qp4Wdz+6yWjk6xjTY1/pmxL aONg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gPWPu2UM; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-123530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123530-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f5-20020a05620a20c500b00789d9637e09si2086249qka.726.2024.03.28.12.59.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 12:59:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gPWPu2UM; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-123530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123530-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 503111C2EEFA for ; Thu, 28 Mar 2024 19:59:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B81B313B7AC; Thu, 28 Mar 2024 19:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gPWPu2UM" Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D5013B791; Thu, 28 Mar 2024 19:55:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711655724; cv=none; b=I/hWT3f2q4eETqKllJBk+/0y+12HNeLjsMHw4CG3TJZ/ak0AZTjj7mQZaETluykr52HUiAyouF8S26Yt0OW/jw5R5mVzyJ2UR5lGsPLAOhgbk1MO9FcG/5OdXcrnZKGgEcw9V4ikm7TxEk+dDu545XjORx1l+G4bqDSk4C9IAX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711655724; c=relaxed/simple; bh=cjEsbiErL4GEiLgWPr00zMhV+ra7917lJ1keLF6jIuU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f3nlPS7Iay+xmHrqX3yqb+u0KovwtLLbBD3y6DKEfjRz+qKzII7DcQ37OR7V7dNBaA8LfPte7DbR0XR4FI4P+ucmq7h4qUN4d83xx7qZti/i0ii7yQXS2H9qZbWlJMUQnJxP8vFD4zPGW++rRp39z3NXsRQRCXaYymA8vOjlpGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gPWPu2UM; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6e6b22af648so1810277b3a.0; Thu, 28 Mar 2024 12:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711655723; x=1712260523; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3onkuNTqsbsPIhsygl1fro8dFk+/knTOJGgy1+clLaE=; b=gPWPu2UMrdNMHAZtDJp8iahagtqXaTKstTkTrUSr/k7+F9uI5F25MsM8vSdH6qfYUL Eh9r5I9feTiNtqtIGRU1fJqWBw5LzTucgGinku1zcC3CcT8wmhwFYB12t7DUQUFtNyUm DHtsxm7IShaBcJK+oryafg86T2pPdkHINxm/bB2QdLcP/X/XVFm2MWxXIRNtfskTp4Oz fJ4WzUXP9H/naottyJouNLOS7/C7BcmwTkWbXMUWr1c7bMTingRodQPVDNuoGqfGYY1C 66FfVLkKNloKXHF5kOI1YFtrUzlmllB91L6GGtCi/nJ7IVH5/60/068ommHKvBQeCxZy jEuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711655723; x=1712260523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3onkuNTqsbsPIhsygl1fro8dFk+/knTOJGgy1+clLaE=; b=c70/XWa16ITaHO5BAmzJrjm61bAsWjn8/ZTH4lAcdSBycyDlG6avflqmYOMLL5LcR7 csM/3esfC0wsHY3rqo/Gk68oXa1IqWwFM7BUlF23Q0T54Tj1MArdONovPnUdRkQfE7pi VZTgKahiD/T2MQYlCvT0HV1tzU5BoGuUAlX897qwlrbecK2qTWtOZm/828jP3K80oF5K ZzFEDfypqr0VZ6nd64ndBF70cmvOLMdVFpbmftqkn03Jt993yp9LRAr+gCw9/9qkw8kM rGXPvGLCB6mJ5ePdFWfeQdj+DLjZSbtxTM2b2csbaiclphUg+sc7sBdaqxV4yCdRCiA6 NwVA== X-Forwarded-Encrypted: i=1; AJvYcCUGvW1Gb0JZNIegFvAYTj+vhRU/UuainNVBj+7E1A4HgwgzGuT07HC0oSLF3vn2yJTRVpN6n4Yi2I8twe7iGQ7qteIm5KqYa4jnKkYw X-Gm-Message-State: AOJu0Yzu+2+sDTdPIi+wOyNxI2oWiHgB1PxGyII2VpwFrEj893XXeaLQ COGJM3Eq9NPL7MJjVeOBZ+RqkQ2NedcHU1I6DJnoPVI6LDlFoZnhTXVWZ0Ev X-Received: by 2002:a17:902:f54a:b0:1e0:aca5:fd24 with SMTP id h10-20020a170902f54a00b001e0aca5fd24mr498128plf.24.1711655722792; Thu, 28 Mar 2024 12:55:22 -0700 (PDT) Received: from wedsonaf-dev.home.lan ([189.124.190.154]) by smtp.googlemail.com with ESMTPSA id p16-20020a170902e75000b001dd7a97a266sm2006520plf.282.2024.03.28.12.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 12:55:22 -0700 (PDT) From: Wedson Almeida Filho To: rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , linux-kernel@vger.kernel.org, Wedson Almeida Filho Subject: [PATCH v2 2/5] rust: kernel: require `Send` for `Module` implementations Date: Thu, 28 Mar 2024 16:54:54 -0300 Message-Id: <20240328195457.225001-3-wedsonaf@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328195457.225001-1-wedsonaf@gmail.com> References: <20240328195457.225001-1-wedsonaf@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Wedson Almeida Filho The thread that calls the module initialisation code when a module is loaded is not guaranteed [in fact, it is unlikely] to be the same one that calls the module cleanup code on module unload, therefore, `Module` implementations must be `Send` to account for them moving from one thread to another implicitly. Signed-off-by: Wedson Almeida Filho --- rust/kernel/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index 5c641233e26d..9141a95efb25 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -62,7 +62,7 @@ /// The top level entrypoint to implementing a kernel module. /// /// For any teardown or cleanup operations, your type may implement [`Drop`]. -pub trait Module: Sized + Sync { +pub trait Module: Sized + Sync + Send { /// Called at module initialization time. /// /// Use this method to perform whatever setup or registration your module -- 2.34.1