Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1309870pxf; Fri, 12 Mar 2021 06:56:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJRpzm0HSOxz7Q3qjY5wmUcn7XqKmuxWcRXFzB5UtX0otWQUqV5QIqEVrun10uLPuZLj1u X-Received: by 2002:a17:906:4a19:: with SMTP id w25mr8777187eju.180.1615561008154; Fri, 12 Mar 2021 06:56:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1615561008; cv=pass; d=google.com; s=arc-20160816; b=eFYKP5qrkv+Qo1ZR2y40mq4vEKyq1Xw6eqIDrEhVN1PvBZ2LJnfAYbBliRXUS7+zdO w6NmBmTNaXT4xH3/cztIX8RvJPgbxOO1olcMqOISN7gUMO8vHVxmQgXDK5nTj1wuf3Cj +Tf8DOitn2Kk/G9m6lbEQMOQ3is9zzNblneg3QHQom+mCtMbQr/3aOaW+oeGFIf8Qc+0 aAYzehJa3jzWPzhLHQzjhkcPOkMwXjRjuN4+jRSyVLClgXbPAkqueDHiayOgOBKbpTDZ WsnUvEbzSKIJcFVBaf/5rP4zj2Rh0b3Rg0epNxXluqWOJdHiFW9LnQH9cikEFEHR9L3x OKSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QrKz109+QtTaiqMToTFOgc22uC4OAicGA0DKsvjRXMY=; b=OfB/K9D5ZEq9A+ZGidIBcIJnq7gW+qyBSQnHGsBj/N1LVCxNZ/PJlksx1Gens3BjGB TCUQfTrzKbUsB2ZrpqLyKUE1HSUqQuXuvmgyysqE5zY4rCP8kQvUfWVmKGg6gWJYF1ni Ijuhjx0hgbJAiOvWN3pJxbyeOxB+SH4aN9FEQVWOhBSh5R34SfVdSAi4zHCGcdMyIByd POr49tGK/fgVsbJQlNXosh1upK4Mqa3aVMQylbYbUFe3V8GjgGZkzUC/UFEWFuXJL1Aw 9O5qDb2GrCwi0jFGnI3yTZyp9Yzqhvh08QtcENw+oP3B5MOViVUC8FFU0NqFhTK2DcVh Rt7Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=MI8se11L; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si4301765edq.484.2021.03.12.06.56.24; Fri, 12 Mar 2021 06:56:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=MI8se11L; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231351AbhCLOy4 (ORCPT + 99 others); Fri, 12 Mar 2021 09:54:56 -0500 Received: from mail-dm6nam10on2066.outbound.protection.outlook.com ([40.107.93.66]:29121 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230443AbhCLOyn (ORCPT ); Fri, 12 Mar 2021 09:54:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y/Cg3uEH6M7VOqkn3tPyXQTA8hgo+3jiY6FQVgvPcuN0LS61yRXfsLoZNY9Sfqdl7x3r9ewij7c6ZgYGXTuD9ONac7psR+W+AT+3Aop2Zlx43gwJioDegnDhknzszUrHarNBT6x6cdN5gA3h8UFg1c26FrvwaL24etciLDm4QgN7RWSRDwVY23UV88zzukkUPx7SqRjcDco6uYW9H6N8/9wVqhDxIrMiXrtuJMbYOsYgNDWCnZFtOrx7tdye3HeKyl6v+Qb4jnbiob6Su7QoAVLF/FkBKU5Ln+S9ACsDExcW7IRfVyiYpkRGV91GpCX17p3x5T/ukDW+l8vMRA5W9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QrKz109+QtTaiqMToTFOgc22uC4OAicGA0DKsvjRXMY=; b=IR7ryu6LQyX1vmCBW4xmOCorzaqCBg+TIexQTr7gzFH/WYfWhLYU04NIy7qPWa50kBMIGp3+38//8c226Nm3e2CyD7AgEZiwADnJhiABrkioAliPC3f8aSKr3LrIxjRhcLyBaGUxbAZfo0tF5SNgd9NCrf57rAok1Sy/4+lDunQe9oZ2263W+RhobowCn9vNUUpQm8D66TK92Ri0+tVhVU8acagEQu0pBJy3KYlRj/BQ8l28J/k2Idl/EiIUnSafysI+ZlupbuMy9CTQjb1oWEisaxshvwK19iylpvjyK+reHgq3rj4/w+o3PLhqA/TysDEma02Iv/sty1bQXM3S2w== 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=QrKz109+QtTaiqMToTFOgc22uC4OAicGA0DKsvjRXMY=; b=MI8se11LehMz4nD8CW+Fe1EtXtt4c2b4iNfnNwP0vEKXlEtBv5JuMqiLBd+S5nq1fx4CKudRZzUBzu1F5v2syyushNA7k6rQd+4QDqZIHJd4wAi9u3vbVJMRq4hsNPoagXSMUs32rpns/1o1b3Kow++aJMRMxrQQQS34S84atRstbgPpA58S1vv3QCqujaZ0Uo8vUi++CTf+yIiJie4wCu8X05adN5vDnfz0N7HvFYWD+AtXzZDjCZAnBWJVCurO0QeG13mYO6o/1R9okVqHzOwS0+txC5JoNCZ1igDxsN9uTrFkV8Tk7DCp2rLCWq5Zzcw/95WhAK6gotNX+wbEaw== Authentication-Results: linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM6PR12MB2938.namprd12.prod.outlook.com (2603:10b6:5:18a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Fri, 12 Mar 2021 14:54:42 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87%6]) with mapi id 15.20.3933.032; Fri, 12 Mar 2021 14:54:42 +0000 Date: Fri, 12 Mar 2021 10:54:39 -0400 From: Jason Gunthorpe To: Jacob Pan Cc: LKML , Joerg Roedel , Lu Baolu , David Woodhouse , iommu@lists.linux-foundation.org, cgroups@vger.kernel.org, Tejun Heo , Li Zefan , Johannes Weiner , Jean-Philippe Brucker , Alex Williamson , Eric Auger , Jonathan Corbet , Raj Ashok , "Tian, Kevin" , Yi Liu , Wu Hao , Dave Jiang Subject: Re: [RFC PATCH 18/18] ioasid: Add /dev/ioasid for userspace Message-ID: <20210312145439.GD2356281@nvidia.com> References: <1614463286-97618-1-git-send-email-jacob.jun.pan@linux.intel.com> <1614463286-97618-19-git-send-email-jacob.jun.pan@linux.intel.com> <20210310192301.GC2356281@nvidia.com> <20210311145534.6fe9bb9a@jacob-builder> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210311145534.6fe9bb9a@jacob-builder> X-Originating-IP: [142.162.115.133] X-ClientProxiedBy: BL1PR13CA0305.namprd13.prod.outlook.com (2603:10b6:208:2c1::10) To DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.162.115.133) by BL1PR13CA0305.namprd13.prod.outlook.com (2603:10b6:208:2c1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.10 via Frontend Transport; Fri, 12 Mar 2021 14:54:41 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lKjBX-00BwIz-Sw; Fri, 12 Mar 2021 10:54:39 -0400 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 668dc24c-10f7-42bd-7822-08d8e566c43c X-MS-TrafficTypeDiagnostic: DM6PR12MB2938: X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JAqJAS6YzxfhMnw4Y7DJqZNsU3b77EKHxsr3JIJrnvU27ElbKnzXPfEGpN06+zIfyjgEyLwKMmKLajWmChKGVsHnOedRLGCTLg1MCUFzCETpbNKwzUGGIopqy235vbgJvPvYPqVcPh5fDmKHsmWNz4p1nyNcUyOjU1ozcVXh5M9LGouComOTQw5u+fHuYu1bzrA5BWxgT7JxT7kvftVarKvR/Q/90Dtf+N/YzLoXnCO8KwCzk1DVE0dtpUKeKQY4QFwEgcCuFKy6G/0dGTOhdKCY6km/3pUhi2B8NnZR9wz0kmUEIx7G46o2nbDloKgmEr+MFe8v7xtgqXTO+Atw4u5/2sScQAJ2q3S/vPehTpd+Urrs2el2ppJkxpllTvi9jJk1fLQG3nuUUwkPjC99+dX57/jzoz/55xDM3cHh3odYAqMD4Rp1NpUden/EDbGDUVlzfiYzrfLoev2XzgolmxiTQip7/AX/bPFaB9FtQmd3j6dE8/ApzgxI1K8DVS1FcFjEYBRaPpvhxjGQ5V0DL/N7uu8Q5BQ9tYgbah7eHjzPgnhJX7TNUV76WnFQuVFy X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3834.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(39860400002)(396003)(366004)(136003)(5660300002)(1076003)(7416002)(316002)(2906002)(9786002)(478600001)(186003)(6916009)(54906003)(8936002)(9746002)(426003)(26005)(2616005)(86362001)(4326008)(8676002)(33656002)(36756003)(66556008)(66946007)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?aXrpdGF12x73C3geqdd9IUXB4zCmFm3irTTmtVD6uRYkSUQlYJB6GjoluwPm?= =?us-ascii?Q?bK/KoxIdma99mD9lm11vafRffvqUyoAOEdNqWXWdvQAzU6alt9s4Luf8ff1O?= =?us-ascii?Q?RxrtYw5BefUxNt2KQa4femYB04LI+k2e0UEraqhmhb4usrCiwGBGOHHBnDZx?= =?us-ascii?Q?zvf3ktZoBPUgki8C2K6BfoMQGBwUp/cnEQdbDcgMKpTg7rsAPEit/qKdzw4p?= =?us-ascii?Q?y6WUtfMDoWd+QwrULpnqmAmtGkXy7qUWlReEIPcHO0ROBKqdNz68wBGdeFdV?= =?us-ascii?Q?qwoNgmk4KkVSt+Nc9zZFp0lXdwJ8ug35oTEyztmxKtRKAoSBI80QIM51E3cF?= =?us-ascii?Q?0E12PTIZf06jV/+/Sb3l/8OXYa19fAA9k0X1vp0DBnfuey+59KiSUvVUyPSy?= =?us-asc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71k+PEeh0utxO2IIb2AH0tBRJjUETF/6eE?= =?us-ascii?Q?chFFee+0xXhvUcHtGffqgMuW1JDNrgwIy2+ZkiRyKNykLw=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 668dc24c-10f7-42bd-7822-08d8e566c43c X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2021 14:54:42.0194 (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: nf2h16lYqkvpmjqLkygwbxNYbCASjNFp3fy/D/zcJd3Sff0qI3JXigSUqwGkoyRH X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2938 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 11, 2021 at 02:55:34PM -0800, Jacob Pan wrote: > Hi Jason, > > Thanks for the review. > > On Wed, 10 Mar 2021 15:23:01 -0400, Jason Gunthorpe wrote: > > > On Sat, Feb 27, 2021 at 02:01:26PM -0800, Jacob Pan wrote: > > > > > +/* -------- IOCTLs for IOASID file descriptor (/dev/ioasid) -------- */ > > > + > > > +/** > > > + * IOASID_GET_API_VERSION - _IO(IOASID_TYPE, IOASID_BASE + 0) > > > + * > > > + * Report the version of the IOASID API. This allows us to bump the > > > entire > > > + * API version should we later need to add or change features in > > > incompatible > > > + * ways. > > > + * Return: IOASID_API_VERSION > > > + * Availability: Always > > > + */ > > > +#define IOASID_GET_API_VERSION _IO(IOASID_TYPE, > > > IOASID_BASE + 0) > > > > I think this is generally a bad idea, if you change the API later then > > also change the ioctl numbers and everything should work out > > > > eg use the 4th argument to IOC to specify something about the ABI > > > Let me try to understand the idea, do you mean something like this? > #define IOASID_GET_INFO _IOC(_IOC_NONE, IOASID_TYPE, IOASID_BASE + 1, > sizeof(struct ioasid_info)) > > If we later change the size of struct ioasid_info, IOASID_GET_INFO would be > a different ioctl number. Then we will break the existing user space that > uses the old number. So I am guessing you meant we need to have a different > name also. i.e. Something like that is more appropriate. Generally we should not be planning to 'remove' IOCTLs. The kernel must always have backwards compat, so any new format you introduce down the road has to have new IOCTL number so the old format can continue to be supported. Negotiation of support can usually by done by probing for ENOIOCTLCMD or similar on the new ioctls, not an API version Jason