From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35F91606A685 for ; Thu, 3 Dec 2026 16:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=V7kY9fHA Received: by kanga.kvack.org (Postfix) id 01A4C6B05B8; Thu, 3 Dec 2026 11:26:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F0DA86B05B9; Thu, 3 Dec 2026 11:26:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB1666B05BA; Thu, 3 Dec 2026 11:26:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B199D6B05B8 for ; Thu, 3 Dec 2026 11:26:45 -0500 (EST) Received: from smtpin20.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 47C474075E for ; Thu, 3 Dec 2026 16:26:45 +0000 (UTC) X-FDA: 85503200370.20.615B83E Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11012014.outbound.protection.outlook.com [40.93.195.14]) by imf03.hostedemail.com (Postfix) with ESMTP id 4122420011 for ; Thu, 3 Dec 2026 16:26:42 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=nvidia.com header.s=selector2 header.b=V7kY9fHA; spf=pass (imf03.hostedemail.com: domain of xinmengs@nvidia.com designates 40.93.195.14 as permitted sender) smtp.mailfrom=xinmengs@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=pass; t=1796315202; b=iZhAuB6sEBrGSaX6+bPS9cQMNGuvxipncokrqZWakNPrkEKECGv4zZG0F5L20HHqHGnP5W HWc6o9OszXeBkNat+kdx/EnMLggAuNHJyr+3wrhphV80GG0z6n1k/U5MKl2yQNF8FKPzM+ 6P5VsRQkAUYLoC5yEjOyKQ8/3qZ1ecQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796315202; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G9pY7nA9EUY1SD6ykJudfsftobH2FJ+lzs0UpWOCVSk=; b=eA4gC6QAFWxM9wupTQmJIPjdlYmyvJViy92FRauglEqW6z+eyqTdrS+kWOFLzbSy74oIIX 9/fzqJlQl1wLtRyO9JCMVrfqGHPbMGH4HGC/hLbtn2JUL/ScxayG+NRSA/5XjD3GRuLvmy s3pxnL+WDoNlGiLIEe+2EuBIVoSlgUg= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=nvidia.com header.s=selector2 header.b=V7kY9fHA; spf=pass (imf03.hostedemail.com: domain of xinmengs@nvidia.com designates 40.93.195.14 as permitted sender) smtp.mailfrom=xinmengs@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nXtuYy8Z/4EUzz2JBEYAOecdRk4VQ+g571WGmwDeT/RJQSwcH1AZB0jjPndEW9lsrcCtHqYm0tp9QZ/GO82XRlT573t19CVJZeVRyAx/RCfNb7BbXbUuBwyqvST9vHVgRXiI+SwQ2RlYP8g3aRCpaX5P3KPUheETq9MOsXQE13EQ5QzaPlQJfrd+T7KdvoDsOC4pAeVsa65BcnMhVXeGw8qJfr3dtcXWKV4vTau35t4Tuh9Dg8gbP7QLXRS1KI/0fkAYyKCnTCbVnlume56eOcNS4jttrBnHoLSY3Ym0czGAqamX+h569iAoFgCQ8hsrr4yEIAJH/BaxaaEwGRDu8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G9pY7nA9EUY1SD6ykJudfsftobH2FJ+lzs0UpWOCVSk=; b=QkjhtmdlUedXS/NV2U05c+OKGOJ2sO1JCN5twO/ranYXJtiuKbtCcXaU1/rmxgTwaLZu0M4XlIa2Yfj792dlzKZ+gOZMC5VnTR5aCvlcq5yimOTNhZJKBuQAwKBzALCSPFpQT3dHFtwh7XdJjGPOYHQrn6HT8i0K1RI7p12JICY45TmCB4Elv2yUh8CEnF6iFgQab4zTQMGVP85Vu+bBxm+CF/2N0tcIIn1L6NhgTScx64PMvuKrbAdnKWoDw6ExA7hQFXx83yVb92XYCWTmX9zGYp8hN7/zn8XQUBjM4FoxXzO8jo+SH7vMWddMCsvqMy4ZngAajDYdKXdzJmVtyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G9pY7nA9EUY1SD6ykJudfsftobH2FJ+lzs0UpWOCVSk=; b=V7kY9fHAzRPWXD/AnWD2qb7Ipk2izGwzPSJ7zipgyiFNhuB+HpyoIIqHdXYOVH4eiODq88ffYnFuUZGE3uw3EGK/tmlQOtPbAouUfILguigBEcfW9iKi+Bv2IZ7beoDsAS+7rlhVlrD7inWV74tEXMosYbZcpAGGLrmKTQoFDTZru4OsTFzn+7UJ87hUF4GDSyLtYs1NrLvou4lxBVxUOQ6hRHwuPgcPmoe/QAdzxoRasM6g7I6ziruggMQW9r10rb2DjcHleSAabqv+6MPwidpJ6fwZil208bQfu9U7p5XKBcgSnjNjxwIWjDISo8ny2zX8ymY5RwWmZSQcfbtlMQ== Received: from CY5PR12MB6549.namprd12.prod.outlook.com (2603:10b6:930:43::6) by SA1PR12MB7344.namprd12.prod.outlook.com (2603:10b6:806:2b7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Thu, 3 Dec 2026 16:26:35 +0000 Received: from CY5PR12MB6549.namprd12.prod.outlook.com ([fe80::2cdd:a549:db13:202b]) by CY5PR12MB6549.namprd12.prod.outlook.com ([fe80::2cdd:a549:db13:202b%4]) with mapi id 15.21.0688.009; Thu, 3 Dec 2026 16:26:35 +0000 Message-ID: <30de192f-8bc5-421f-9dd8-c1054a13575d@nvidia.com> Date: Thu, 3 Dec 2026 11:26:25 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/5] rust: vfio: add common VFIO device handling To: Gary Guo , Danilo Krummrich Cc: acourbot@nvidia.com, kvm@vger.kernel.org, rust-for-linux@vger.kernel.org, nova-gpu@lists.linux.dev, linux-pci@vger.kernel.org, Zhi Wang , alex@shazbot.org, jgg@nvidia.com, yishaih@nvidia.com, skolothumtho@nvidia.com, kevin.tian@intel.com, airlied@gmail.com, simona@ffwll.ch, ojeda@kernel.org, alex.gaynor@gmail.com, boqun.feng@gmail.com, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu, jhubbard@nvidia.com, ecourtney@nvidia.com, cjia@nvidia.com, smitra@nvidia.com, kjaju@nvidia.com, alkumar@nvidia.com, ankita@nvidia.com, aniketa@nvidia.com, kwankhede@nvidia.com, targupta@nvidia.com, linux-kernel@vger.kernel.org, zhiwang@kernel.org, boqun@kernel.org, daniel.almeida@collabora.com, tamird@kernel.org, work@onurozkan.dev, jgg@ziepe.ca, bhelgaas@google.com, kwilczynski@kernel.org, dri-devel@lists.freedesktop.org, peter@colberg.org, "Liam R. Howlett" , linux-mm@kvack.org, Lorenzo Stoakes References: <20261127224928.1511382-1-xinmengs@nvidia.com> <20261127224928.1511382-2-xinmengs@nvidia.com> Content-Language: en-US From: Simon Song In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SJ0PR05CA0088.namprd05.prod.outlook.com (2603:10b6:a03:332::33) To CY5PR12MB6549.namprd12.prod.outlook.com (2603:10b6:930:43::6) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6549:EE_|SA1PR12MB7344:EE_ X-MS-Office365-Filtering-Correlation-Id: e2182c6a-e3fa-4c81-5af3-08df515a3281 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|7416014|376014|366016|1800799024|261028144727099003|261026121527099003|261102123227099003|261022105027099003|261022075727099003|261026140227099003|261021121427099003|11063799006|4143699003|56012099006|10067099003|261009223027099003|18002099003|22082099003|6133799003; X-Microsoft-Antispam-Message-Info: UpBJJBvFzd31KOxoluE1CcSdSGIX+l4ooc9JzlfkgJuLbME963c4J8iFokWdpppctGCAreT38Z616uSIdVHrJXi0l+1PnE/8moJvQ+3xpFyhwMPDBNvDCNGi0iSOSLcrdU8ZVJhGniEVi1NfDZ7G3xd/JLNx40tGo+AZLbN9RI+3yyLB3DtdbIKCzsJG0uaHliYA5Cr0LawMBNJDL79PKaVYiD75oM6laWix3nkNSYBvgnjz9jqExSze8EVCpnCrO+miEhJAgASPepP5kn1ZiKO/HJynl0Q/P62rfobQuL1+wbmlAOTFmqGcKl4MXkoLXl1XtKz/H2oqFRefmJjRvejak0GFKt4uj4lI5qIgkPN1BLYOvs/2zM8yOND4oC4w4jWvylDtjiAtSBcPf/ZP8a9amX6gsm44bANO1eufcXGGi+gqQK/v03yRm/Q5/Jl9l8NXCuuaA3B5Ygz+CripXnwElf3gFBL9ELG6mHtNCRS/08A5mCgxYJld/JZQgT9NUweA0yF6VIzrppchYbtdiWurZjC9mGkuo9OAz1esMS6N5hRZNaMcsc9j3Ocjj9XRZf9FNWAs0AYrFA0rbI3Kw9kJnd01TwVJq7/JFuqZMbAT/ZLx3zMhccntTmlQX89GiXERkAsRBm5wTX3llUf7mkU9bJwt55IgDmgmhn9pIg8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6549.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(376014)(366016)(1800799024)(261028144727099003)(261026121527099003)(261102123227099003)(261022105027099003)(261022075727099003)(261026140227099003)(261021121427099003)(11063799006)(4143699003)(56012099006)(10067099003)(261009223027099003)(18002099003)(22082099003)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cFM0K3pDZnV4NHUrRUZLemNtckhrRWZ4V3RURW9HY0pIckxmTnNRc3VVS2s0?= =?utf-8?B?SVN3Nk8rWGVyanU3ejd3RVNQT24ydEVaSGZNSGFSWnJBVXd3SllMcVFuL05I?= =?utf-8?B?Y3A1dXZGS1BsZW9Hd2dqeTljUWxzWmF0cGV4eU9UUHpKYnI4bTdoOTBJSGpK?= =?utf-8?B?OFlzS3JuWDNwU2VVVXdaNEhYaHF0SG9pKzZMenMzUmZxSzFKTmVETEo1dktV?= =?utf-8?B?clhDQUdpd083eG9PL0NtR0k0aElYS0JtOHkwYllkZzV0dGxUVlBWdnBSZDNM?= =?utf-8?B?NzYwcGhWOUptU0RiUjdnOHFvTXBlaCtKcE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CtPMEtBa1hhR1g1Q1VPYVF5RGpGOVgrL3hBNHBVQkw2eUhLclFRLzlWL1gv?= =?utf-8?B?QU5ER21BN0ZWZkgyaEI1Vi9pZmd1ajVYeTdFbkgwdXFmMHNRckJxN2tRQ3J5?= =?utf-8?B?NDBSSWhXOFlDMytLL0IrcDV3UW5wSGpiU3VibDVNcGx5WFBuc2NNVHVUdkc5?= =?utf-8?B?WDNUcVNSWGluNk01RnVDY1ZZNXh3WVRMYjIwa3BONEF3WnpOVVNzdz09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2182c6a-e3fa-4c81-5af3-08df515a3281 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6549.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 16:26:34.8573 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q5/ppJUd0U1Gf4cUJi9wMT7qfi7Ykpoc8L/PVNjPSee2xEuQio9m0Ej+dFKbxEb9qAwFpJWYKAudTz8Mn1cVrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7344 X-Stat-Signature: wb6a8auk6z5hnnw4kyh4pjtr5jq6nk6p X-Rspamd-Queue-Id: 4122420011 X-Rspam-User: X-Rspamd-Server: rspam09 X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-HE-Tag: 1796315202-998165 X-HE-Meta: U2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adnuMkG28RuL000fNXb8AVkcZQDj1B6In1UsjyLHMSUR/zaUb3tV5ImmcCgxA6qedZY4rhxk+wGyEcVSs3Jgm5GCRjkPHkHzVGKdNeScVmLknmodup7pqId6YcLF1Tvlk/+kxUWy9dW5+mCy9KTpTEZu0TdOm9OzZBxuotgWqeLRZOW32F5odFEV0jVkzOCSgl3npH6ODktA+co8u28kHyrIMWJrHz2l1tQGy9hKfzyhb5bFQbBjTdbLvYQU4648NQZERCtwL9W9y/pYVf2w4dvGcYdvdDGKXjLxNWhdY6Jbe5gcu7+gbABR4Vy1X33JeDOk/mGQBcQJ2aZEx8KNlQOwKQ4Fy00rOJzkok9qY3Ujpd6hBoM4HvGpgdPL143hDmNUF8T7Rewy8uy2ysk4bJxRzl3ndz+QNsMYjDPOulhiZRa4C4GkIJaf2WS7FD35HKvatvIApUqrg+5SbidyYxMH+O/pvMcwFglJBvqvyyRLNS5rDbeDgj8tku1dNKURHU1p9br3PnWDUxewbaJccXUX17HOMmtM+xyV/3BbCP0Bjlgdr+l43xpZVhXsstz7SmIkq3VwlCBgQf3FH2lpVQHbFMNJYYMcQXhzfGkvAZFTv0Op3MeBH+/B7dAtu3aLu8O5CVzcm76Zl5Jg5uPhbseePKCpWVFuLBeZ9pl2G0WjweeJMwo1XXKPxYTRX9py+vvhrr1VkvuZr3SC7lnOwrYDNOpqZf6BIV7sno= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 12/2/2026 1:43 PM, Gary Guo wrote: > On Wed Dec 2, 2026 at 5:55 PM GMT, Danilo Krummrich wrote: >> On Wed Dec 2, 2026 at 4:58 PM CET, Gary Guo wrote: >>> On Fri Nov 27, 2026 at 10:49 PM GMT, Simon Song wrote: >>>> rust/bindings/bindings_helper.h | 2 + >>>> rust/kernel/lib.rs | 2 + >>>> rust/kernel/vfio.rs | 454 ++++++++++++++++++++++++++++++++ >> >>>> +/// The data the driver of a [`Device`] shares with its callbacks. >>>> +/// >>>> +/// Bus-specific operations traits extend this trait. >>>> +pub trait Operations: Sized + Send + Sync + 'static { >>>> + /// Data owned by the registration and passed to VFIO callbacks. >>>> + /// >>>> + /// It can borrow resources of the driver's binding for `'reg`. Per-device state lives here. >>>> + type RegistrationData<'reg>: Send + Sync + 'reg; >>>> + >>>> + /// Data shared by callbacks from the first successful open until the last close. >>>> + /// >>>> + /// It can borrow the registration data, of lifetime `'reg`, for `'open`. >>>> + type OpenData<'open, 'reg: 'open>: Send + Sync + 'open; >>> >>> The lifetime here is confusing. `'open` is actually the lifetime borrowed from >>> `'reg`, and the `'reg` is lifetime borrowed (usually) from the device. >> >> I think it's reasonable if this is read as 'reg is the lifetime RegistrationData >> is constrained by and 'open is the lifetime OpenData is constrained by; since >> OpenData may borrow RegistrationData, we require 'reg: 'open. >> >> With that reading, I think the above shouldn't say "the registration data, of >> lifetime `'reg`" though, as this is misleading. >> >> That said, I can see why you say it is confusing if you read it as "borrows". >> >> In this case we'd probably want something like >> >> type RegistrationData<'a>: Send + Sync + 'a; >> >> type OpenData<'reg, 'a: 'reg>: Send + Sync + 'reg; >> >> 'a is usually the lifetime of borrowed device resources, so it could also be >> called 'res. > > That's okay to me. will rename to 'res / 'reg > >> >> I'm fine with both; but in case of the latter I'd probably prefer 'res over 'a. >> >>>> +#[expect(dead_code)] >>>> +impl DeviceBase { >>>> + /// Publishes the registration data passed to callbacks. >>>> + /// >>>> + /// Returns [`EBUSY`] if registration data has been published before, so that a device can >>>> + /// be registered at most once. >>>> + /// >>>> + /// # Safety >>>> + /// >>>> + /// The caller must serialize calls for this device. `data` must point to pinned data that >>>> + /// remains valid until the device has been unregistered or, if registration fails, is not >>>> + /// accessed through this device. >>>> + unsafe fn publish_registration_data<'reg>( >>>> + &self, >>>> + data: NonNull>, >>>> + ) -> Result { >>>> + // SAFETY: The caller serializes publication, and callbacks only read the slot. >>>> + if unsafe { (*self.data.reg_data.get()).is_some() } { >>>> + return Err(EBUSY); >>>> + } >>> >>> This looks quite strange. >>> >>> I believe this is only here so you can never call `Registration::new()` twice. >>> But this raises the question on why you'd want the user to create the device >>> first before giving it to the registration. >>> >>> I think this should be one of the either approach: >>> >>> - Never allow user to create the device directly. Create it inside registration >>> and expose it to the user via registration only. >>> >>> - (drm approach) If there're some configuration needed on the device before >>> registering, create a `UnregisteredDevice` (or `UnpublishedRegistration`) >>> type. It is then converted to a `Registration`. >> >> I think this is fair and in my PoC I did it that way to make it a bit more >> accessible reading it coming from C; I think it should be the former for now. > > From patch 5 it does seem that there's no use case currently for an unregistered > device, so yeah we should go for first approach (even if we need to do > configruation on unregistered device, we can add that while keeping the direct > registration creation as a shorthand). > for the respin, will make Device::new() internal and allow Registration::new() allocate the device itself this also gets rid of the EBUSY path in publish_registration_data() since it cannot fail >> >>>> +/// Opaque wrapper around a `char __user *` buffer from a VFIO read or write callback. >>>> +/// >>>> +/// Provides bounds-checked copying of kernel data into the user-space buffer. >>>> +/// >>>> +/// This type cannot be constructed by driver code — it is only created by the >>>> +/// callback trampoline. >>>> +pub struct UserBuf { >>>> + ptr: UserPtr, >>>> + count: usize, >>>> +} >>> >>> No ad-hoc infrastructure for what's supposed to be in uaccess please. This looks >>> like like it should just be `User<[u8]>` (the generic user pointer type that >>> integrates with I/O projection); I have that in my plan and I can prioritize it. >> >> IIRC, I did bring this up previously too. I don't think adding the User type >> should be a blocker for this series though. >> >> We should be able to pass a UserSlice in the callbacks and take it from there >> with UserSliceReader and UserSliceWriter, e.g. with core_read() taking a >> UserSliceWriter as argument. >> >> The only change we need in uaccess is something like this: >> >> diff --git a/rust/kernel/uaccess.rs b/rust/kernel/uaccess.rs >> index f1aecda7a90c..5e95d017b52e 100644 >> --- a/rust/kernel/uaccess.rs >> +++ b/rust/kernel/uaccess.rs >> @@ -15,7 +15,13 @@ >> ptr::KnownSize, >> transmute::{AsBytes, FromBytes}, >> }; >> -use core::mem::{size_of, MaybeUninit}; >> +use core::{ >> + cmp, >> + mem::{ >> + size_of, >> + MaybeUninit, // >> + }, // >> +}; >> >> /// A pointer into userspace. >> /// >> @@ -217,6 +223,16 @@ pub struct UserSliceReader { >> } >> >> impl UserSliceReader { >> + /// Returns the current userspace pointer. >> + pub(crate) fn as_ptr(&self) -> UserPtr { >> + self.ptr >> + } >> + >> + /// Limits the remaining buffer to at most `length` bytes, keeping its current address. >> + pub fn truncate(&mut self, length: usize) { >> + self.length = cmp::min(self.length, length); >> + } >> + >> /// Skip the provided number of bytes. >> /// >> /// Returns an error if skipping more than the length of the buffer. >> @@ -449,6 +465,25 @@ pub struct UserSliceWriter { >> } >> >> impl UserSliceWriter { >> + /// Returns the current userspace pointer. >> + pub(crate) fn as_ptr(&self) -> UserPtr { >> + self.ptr >> + } >> + >> + /// Limits the remaining buffer to at most `length` bytes, keeping its current address. >> + pub fn truncate(&mut self, length: usize) { >> + self.length = cmp::min(self.length, length); >> + } >> + >> + /// Skips the provided number of bytes without writing to them. >> + /// >> + /// Returns an error if skipping more than the length of the buffer. >> + pub fn skip(&mut self, num_skip: usize) -> Result { >> + self.length = self.length.checked_sub(num_skip).ok_or(EFAULT)?; >> + self.ptr = self.as_ptr().wrapping_byte_add(num_skip); >> + Ok(()) >> + } >> + >> /// Returns the amount of space remaining in this buffer. >> /// >> /// Note that even writing less than this number of bytes may fail. > > So there's no need to actually do read/write at arbitrary position? The existing > helpers added feel like it's needed. > > Also, I don't understand the name `read_overlapping` and `write_overlapping` as > currently defined in the patch. > > But if vfio can work with the diff above that you have, I think that's > reasonable addition to unblock the series (with `#[inline]` added, that is). > > Best, > Gary I will pick up this change by Danilo in next series, also I agree with Danilo that forward traversal will suffice for now, and will add the #[inline] as suggested.