Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1176122lqt; Tue, 19 Mar 2024 15:29:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXE/UukYZJIvsxnP4rrHYUqaQsxfS+HK4/8Q7dG7T+nzVQWUXVPsmtnOu10X+dUmnAJS1Oo8oWux6bRXukhOSuYzHcrqIF3UsSl2mreIg== X-Google-Smtp-Source: AGHT+IFROd4R3s55L/QmzwJgPZrmLx9m7J96+LCDmK8PNRVJnQdJR4EZ/xZFzTj1fYD9RHAXQmDF X-Received: by 2002:a9d:6d85:0:b0:6e6:7614:9612 with SMTP id x5-20020a9d6d85000000b006e676149612mr3996332otp.10.1710887351740; Tue, 19 Mar 2024 15:29:11 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l4-20020a05620a0c0400b00789f586521fsi6557936qki.145.2024.03.19.15.29.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 15:29:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@proton.me header.s=2td2hcxam5f4blla4qexiqfvti.protonmail header.b=DwpdCwJ7; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-108191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=QUARANTINE) header.from=proton.me 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 4E49F1C224EE for ; Tue, 19 Mar 2024 22:29:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35A495A4D4; Tue, 19 Mar 2024 22:29:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=proton.me header.i=@proton.me header.b="DwpdCwJ7" Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75B3939FC5 for ; Tue, 19 Mar 2024 22:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710887342; cv=none; b=O+Q+50aAmazbP+7KfsuSFJEbJqoprRR4UWOKB8Du8W1DK/31mrcGLmt1fKoT+qRd0Vpg2T2f9U26r7X7LurJwHEPW4lsVpqaG6IOdej6bXhg/FnmtCTz+A6W84kkxl9WoRupdHtioRYb3e7EuCHC5azyx0x4y+wgWMDLa1MPVns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710887342; c=relaxed/simple; bh=btl7GVMkOPqh3jelHMmXpcxt9NraTyxeTaEChB9epX4=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LyNWYokaqCvOMogo22QRJSYqqSFZJXTSt4gAzD0PT0jeCFZu7J3mLiST4hGKWL38M0q19VNSk1CWNvFIAT3ZPvBOsTH7FcCzIiTy9Xn2/nJk2YAeATPPyQe4GOASdcZygKwjSy4f9dQaWTzgXqPGmzEL3u4oQyK74YQRtz4Qhuc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=DwpdCwJ7; arc=none smtp.client-ip=185.70.43.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=2td2hcxam5f4blla4qexiqfvti.protonmail; t=1710887338; x=1711146538; bh=L20ailqB2zZNQ2Pi1DlqP7RA7u5R9k3CUjUtV3VgrxQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=DwpdCwJ7R0FXhXwrI1LaTEYBTItAi/qrEMzB7FUkf2GbMnh2NaOxQbkwb6P1ixTuv LH5nbCsEpmrJ+pH4texbSAicrUz8XowP6FwhRWKRldXsnhVEus1GkDi9zQaNuUgsD4 Ajz9VBySgeCOjDUe9T1ROslu5kyNNRrPtXsLdFfHYofRkXtvz9sr9Q/D/EodOenOka zSCiebBcGWFEsYAsOKhh3XWb8HFgvM4u9O1O151CY8iIrbO8bEP8Tc14ciW72qjo88 5VEWgoXgpvlMzl4QaBouqB/+zp2cH+z3d9VjVBKPy1/4dFLP88jjFKK8WTlPzhxl2p VthyZsOKjUFuw== Date: Tue, 19 Mar 2024 22:28:52 +0000 To: Boqun Feng , Alice Ryhl From: Benno Lossin Cc: Miguel Ojeda , Matthew Wilcox , Al Viro , Andrew Morton , Kees Cook , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Greg Kroah-Hartman , =?utf-8?Q?Arve_Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Arnd Bergmann , linux-mm@kvack.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Christian Brauner Subject: Re: [PATCH v3 4/4] rust: add abstraction for `struct page` Message-ID: <65457833-adbe-4a60-95d9-8391a746ede0@proton.me> In-Reply-To: References: <20240311-alice-mm-v3-0-cdf7b3a2049c@google.com> <20240311-alice-mm-v3-4-cdf7b3a2049c@google.com> Feedback-ID: 71780778:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 3/19/24 23:16, Boqun Feng wrote: > On Mon, Mar 11, 2024 at 10:47:16AM +0000, Alice Ryhl wrote: > [...] >> /* `bindgen` gets confused at certain things. */ >> const size_t RUST_CONST_HELPER_ARCH_SLAB_MINALIGN =3D ARCH_SLAB_MINALI= GN; >> +const size_t RUST_CONST_HELPER_PAGE_SIZE =3D PAGE_SIZE; >> +const size_t RUST_CONST_HELPER_PAGE_MASK =3D PAGE_MASK; >=20 > At least for me, bindgen couldn't work out the macro expansion, and I > got: >=20 > =09pub const PAGE_SIZE: usize =3D 4096; > =09extern "C" { > =09 pub static RUST_CONST_HELPER_PAGE_MASK: usize; > =09} >=20 > in rust/bindings/bindings_generated.rs, which will eventually cause the > code cannot compile. >=20 > I'm using bindgen-cli 0.65.1, libclang (16 or 17), rustc (1.76 or 1.77). >=20 > Anyone else sees the same thing? I also have this problem with bindgen-cli 0.69.1 libclang 16 and rustc 1.76= 0. For reference, here is the actual compilation error: error[E0425]: cannot find value `PAGE_MASK` in crate `bindings` --> rust/kernel/page.rs:17:40 | 17 | pub const PAGE_MASK: usize =3D bindings::PAGE_MASK as usize; | ^^^^^^^^^ help: a constant = with a similar name exists: `GATE_TASK` | ::: /home/benno/kernel/review/mem-man-binder/rust/bindings/bindings_g= enerated.rs:12188:1 | 12188 | pub const GATE_TASK: _bindgen_ty_4 =3D 5; | ---------------------------------- similarly named constant `GATE_= TASK` defined here error: type `gfp_t` should have an upper camel case name --> rust/kernel/page.rs:21:14 | 21 | pub type gfp_t =3D bindings::gfp_t; | ^^^^^ help: convert the identifier to upper camel case: = `GfpT` | =3D note: `-D non-camel-case-types` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(non_camel_case_types)]= ` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0425`. @Alice: the second error should be unrelated to this problem. --=20 Cheers, Benno >=20 > Regards, > Boqun >=20 >> const gfp_t RUST_CONST_HELPER_GFP_KERNEL =3D GFP_KERNEL; >> const gfp_t RUST_CONST_HELPER___GFP_ZERO =3D __GFP_ZERO; >> +const gfp_t RUST_CONST_HELPER___GFP_HIGHMEM =3D ___GFP_HIGHMEM; > [...]