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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20A22C4321E for ; Thu, 1 Dec 2022 01:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbiLABhe (ORCPT ); Wed, 30 Nov 2022 20:37:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiLABhc (ORCPT ); Wed, 30 Nov 2022 20:37:32 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE38958034 for ; Wed, 30 Nov 2022 17:37:31 -0800 (PST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NMzFX6l7QzRpgt; Thu, 1 Dec 2022 09:36:48 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 1 Dec 2022 09:37:03 +0800 Received: from [10.67.103.158] (10.67.103.158) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 1 Dec 2022 09:37:03 +0800 Subject: Re: [PATCH v3 1/5] vfio/migration: Add debugfs to live migration driver To: Jason Gunthorpe CC: , , , , , References: <20221128031200.11017-1-liulongfang@huawei.com> <20221128031200.11017-2-liulongfang@huawei.com> From: liulongfang Message-ID: <5c08db2b-386c-fadd-d975-412e4d344b03@huawei.com> Date: Thu, 1 Dec 2022 09:37:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.158] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/11/29 21:15, Jason Gunthorpe wrote: > On Tue, Nov 29, 2022 at 10:02:46AM +0800, liulongfang wrote: >> On 2022/11/28 21:39, Jason Gunthorpe wrote: >>> On Mon, Nov 28, 2022 at 11:11:56AM +0800, Longfang Liu wrote: >>> >>>> @@ -119,6 +132,9 @@ struct vfio_migration_ops { >>>> enum vfio_device_mig_state *curr_state); >>>> int (*migration_get_data_size)(struct vfio_device *device, >>>> unsigned long *stop_copy_length); >>>> + int (*migration_get_data)(struct vfio_device *device, char *buffer); >>>> + int (*migration_get_attr)(struct vfio_device *device, char *buffer); >>>> + int (*migration_debug_operate)(struct vfio_device *device, >>>> unsigned int cmd); >>> >>> Please don't do wrappers like this, give the variant driver a chance >>> to create its own files natively under the debugfs directory >>> >> >> Using this public debugfs file does not need to deal with file >> creation and destruction. >> The driver only needs to define its debug operation command, >> isn't it simpler? > > No, it is obfuscating the normal kernel apis, what if a driver wants > two files? > Yes, if there are special devices that require multiple debugfs files and use the same operation, using this migration_debug_operate() will cause the function to be impossible. Thanks, Longfang. > debugfs is not a heavy burden to implement files for. > > Jason > . >