From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3339D5B15C for ; Sat, 13 Dec 2025 12:47:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 55BEF10EC90; Sat, 13 Dec 2025 12:42:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=permerror (0-bit key) header.d=gmail.com header.i=@gmail.com header.b="mVmqv1/X"; dkim-atps=neutral Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66FFE10E6D5 for ; Tue, 7 Oct 2025 15:41:05 +0000 (UTC) Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-71d6051afbfso70557347b3.2 for ; Tue, 07 Oct 2025 08:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759851664; x=1760456464; darn=lists.freedesktop.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=FaFNh20XxOdj2oQlwRRyR9v75gYMq+FkiOKklphUgxg=; b=mVmqv1/X04O8Qjb97KYfk5ljI7LVl83SdwYb71TWQKDRibogq3GxlTQwqEOxdN90sM XIoeXBn+501miIglcKzhr8PZC0mhBGACGqWMxo6+t103lFrawfNIrw870lvJd3NtitVu xeCj7etCpzF0zyO6H80PWwB2uddzbMi3yuz0WNgeiq+OPVmbWZE3/aLImK8v8W9iJris 1MLlFtr9dhoaDctCMYI3q3AdRtJZdcLvIdEJw2fQVHRPv0Pv2Ci4wcZFRgf/k17sNC7I 6oAgVT4INfHaUV5OLzovdfv23lbA/hp/zOuSvwH7YODA7NTxsQpIzqe3vxlwkIIpjIzE jkSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759851664; x=1760456464; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FaFNh20XxOdj2oQlwRRyR9v75gYMq+FkiOKklphUgxg=; b=Xl3uFUN4jWeSQnJjmHUmWi8zpoM5V/M7zE4i2YMOGpgEYAYUFLjYOJu4vX+vwo7y6W mehb9YLV3ZyjA3JaRVkmWJpgYfQDfxCAAkiCKsU8JgGtfZCkdhTKoH1eZ2UtzdLzXYfj KtVkgx82lziIJ4ldNfNhTHqHdjfak9eyYBr+hVPkne0h0SBf6S7MWgQjrcn61k8mgS/2 R2DPXlgpoX4Ni+Qb4BBxSVYWBlkKEMw5MADRpgyQ/0pM1eyVVB+VusvRJDIzcbUlwXXf jEaVmlN/rdNjkdrnIiL15jaw9a5Pk92bPd6f4Jxmhm4piU1Kn8Gd9q8hAaDL8YucnFZA doag== X-Forwarded-Encrypted: i=1; AJvYcCX/xJt4p7nQ2epgp2311Eyicu0uvF37BscMyUFwA61bGrRyNxL0bHKLtsqBvS0VJ5Iv0nTLGKMK@lists.freedesktop.org X-Gm-Message-State: AOJu0YwLEVIqa1CG4ENH8uL5853rXiGUZbWMYXE5JMpGkERY2+XgIoav ZzIXi++airV4KDhTHNc2HR9T+/QGkAvRXiNgjJXuGw9LNj6v9HgOcesu X-Gm-Gg: ASbGnctNlZne4iMoFrpHxQAIPw4pNwArdplWyVVjygR++BNIOl7ioA2auSO8YonZ4YR fdoxvEtdzcU0HUNxTdEBcj/baT3RsdSJab6Rxc7qPuEZeWTWl7wdEoVQwrrZajUKYiKo8v2Caqv 59HDm5o+ywgW0tQso0CQmynutmQoPGIOTdnOvqO+ueYZWgXUPo8hKASBROA0p/mnA768fAWs1j3 vjJAwnXoQCsluggPlV+dg3A1e/NBjIrFOxsFGyM3lInY4gHfF0TT6y3B1qvcjq2X3y2FB1RY3S7 TB5Xtyzfo54rBBAmNmKOL3FUWLgvdaWr5i2g8T/vfRbt2JjGj3FGWAxY/L7xKNrvm34/zLBomDF 33KLwopOb8QPyfhdkWHvb3s38EjqGl4SlAClIpzEOeV7nGC3edv0zscALxLecWSupGO85hL6dai V8GQw= X-Google-Smtp-Source: AGHT+IEkcHgYm3I1MFNRw2OsYxWZ79jw7Dqd1n6B3m6dIb5JmohqIcLJaaJ9AQ+WvnlX2m3w3mdRiA== X-Received: by 2002:a05:690c:688d:b0:768:70a1:46c2 with SMTP id 00721157ae682-780e15f2ee7mr2747787b3.48.1759851664152; Tue, 07 Oct 2025 08:41:04 -0700 (PDT) Received: from localhost (c-73-105-0-253.hsd1.fl.comcast.net. [73.105.0.253]) by smtp.gmail.com with ESMTPSA id 00721157ae682-77f81d342basm54065697b3.48.2025.10.07.08.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Oct 2025 08:41:03 -0700 (PDT) Date: Tue, 7 Oct 2025 11:41:02 -0400 From: Yury Norov To: Alexandre Courbot Cc: Joel Fernandes , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org, dakr@kernel.org, Alistair Popple , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , bjorn3_gh@protonmail.com, Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , John Hubbard , Timur Tabi , joel@joelfernandes.org, Elle Rhumsaa , Daniel Almeida , Andrea Righi , nouveau@lists.freedesktop.org Subject: Re: [PATCH v6 0/5] Introduce bitfield and move register macro to rust/kernel/ Message-ID: References: <20251003154748.1687160-1-joelagnelf@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Sat, 13 Dec 2025 12:40:49 +0000 X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" On Tue, Oct 07, 2025 at 07:36:21PM +0900, Alexandre Courbot wrote: > Hi Yuri, > > On Tue Oct 7, 2025 at 7:29 AM JST, Yury Norov wrote: > > > Regardless, I don't think that this is the right path to move the > > bitfields into the core. The natural path for a feature that has > > been originally developed on driver side is to mature in there and > > get merged to core libraries after a while. Resctrl from Intel is one > > recent example. > > > > With that said, I'm OK if you move the bitfields as a whole, like you > > do in v5, and I'm also OK if you split out the part essential for nova > > and take it into the driver. In that case the bitfields will stay in > > drivers and you'll be able to focus on the features that _you_ need, > > not on generic considerations. > > > > I'm not OK to move bitfields in their current (v6) incomplete form in > > rust/kernel. We still have no solid understanding on the API and > > implementation that we've been all agreed on. > > Initially the plan was indeed to give this code some more time to mature > in nova-core before moving it out. > > The reason for the early move is that we have another driver (Tyr) who > wants to start using the register macro. Without it, they would be left > with the option of either reinventing the wheel, or poking at registers > the old-fashioned way, which I think we can agree is not going to be any > safer than the current macro. :) > > IIUC your remaining concern is with the possible loss of data when > setting a field that is smaller than its primitive type? That should be > addressed by [0], but as it introduces a new core feature I expect some > discussion to take place before it can be merged. In the meantime, it > would be great if we can make the register macro available. > > Because letting it fully mature within nova-core also has the drawback > that we might miss the perspective of other potential users, which may > make us draw ourselves into a corner that will make the macro less > useful generally speaking. We are at a stage where we can still make > design changes if needed, but we need to hear from other users, and > these won't come as long as the macro is in nova-core. Hi Alexandre, Thanks for the broader perspective. So if there's another user for register!(), then yeah - it's worth to move it out of the nova earlier. It doesn't mean that we need to split bitfields out of it immediately. > [0] https://lore.kernel.org/rust-for-linux/20251002-bounded_ints-v1-0-dd60f5804ea4@nvidia.com/ This resembles the _BitInt from C23 standard, and it looks quite reasonable to me. I'll get back to your RFC shortly. https://en.cppreference.com/w/c/language/arithmetic_types.html -- I'm glad that we started this discussion. From my point, what happens now is inventing the whole new language, and basic bit operations is the heart of it. I would really like to avoid adopting an API that will frustrate people for decades after invention. Please read the following rant to taste exactly what I mean: https://lore.kernel.org/all/CAHk-=whoOUsqPKb7OQwhQf9H_3=5sXGPJrDbfQfwLB3Bi13tcQ@mail.gmail.com/ Thanks, Yury