Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp659436rwb; Thu, 8 Dec 2022 00:59:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf4jqmGfjfA+iRHkJzA8vNw6/NKAd9+HPh5uiixR1PqY1YtqKE4bQN6ay4oVvo63RG+DNGmG X-Received: by 2002:aa7:d6d9:0:b0:46a:f635:6bb2 with SMTP id x25-20020aa7d6d9000000b0046af6356bb2mr43671968edr.270.1670489976778; Thu, 08 Dec 2022 00:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670489976; cv=none; d=google.com; s=arc-20160816; b=SxpfJ50N2IPGTHtB5KDyR2SeP7cXKjiB/DwN8bjW55OoJrq4eeLoKuKNp6yl1xT6qM Bf4I0uYTpyLDsXQNhYl4Xf62v3gbgsManmUZ49WMg/XmCfK6xMsz1opVh6XnGNj3cfXb tahBR8MHGWwEDyiJ9E0iUCcPIzLjRcrqhGXbLnrcrvYOjkODrLYWxM38oN6yodI553/z axaEn8khsPtIHG5oXy47nHZh3H7+sP5CaY16H80lyJx+y38VtUdkpwidJuXzFz5y3SIR QSLPl/b1jQ/qC2i4oOdktmsB2w//xQLUguwyqXQz/hwLvdeeKUWfyhb1W5igjVpzxbwJ Disw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=mEcUTC7TJdkj/yZylxeaw7ZxIdknEINW4GrkanvX8a0=; b=w5XcoL6Bb++c+xKmFF9pxaePsB/G/haItcKGBsfiYicCLnP/Y9qQaQ2vk1cgx6Pmhx AWFrGOftqxEiNsquZQ5aK4v0caj96oF6fUsG+ZoIm9YXvGMYiWQiaf6yuhD/BlfZBCel AQy3pal3vlFijCkXc7bz5KtMVyvP9YOKR/MGRovxSA+/CyATQQC70tgkgYBC+XabdAzP Le/f3nKsI6z4SdQqARE86nJ2ETWPl1I0KR0dHbp39b9+Bj6N8ZAMGP+xYjCmbYmUbuNb n3V3j2KTvGNeeRXqT6iQeDmMYWtopVxP8i0uH17dpWR0/4GR8NRAN71kr+PQdR0XOolz g/NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a50fd84000000b004595af54eacsi5403345edt.226.2022.12.08.00.59.19; Thu, 08 Dec 2022 00:59:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229602AbiLHIkI (ORCPT + 73 others); Thu, 8 Dec 2022 03:40:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbiLHIkG (ORCPT ); Thu, 8 Dec 2022 03:40:06 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E25EC6176F for ; Thu, 8 Dec 2022 00:40:05 -0800 (PST) Received: from kwepemm600005.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NSSHd6BpTzRpsP; Thu, 8 Dec 2022 16:39:09 +0800 (CST) 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, 8 Dec 2022 16:40:01 +0800 Subject: Re: [PATCH v4 1/5] vfio/migration: Add debugfs to live migration driver To: Jason Gunthorpe CC: , , , , References: <20221202092625.35075-1-liulongfang@huawei.com> <20221202092625.35075-2-liulongfang@huawei.com> From: liulongfang Message-ID: Date: Thu, 8 Dec 2022 16:40:00 +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: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/12/5 21:55, Jason Gunthorpe Wrote: > On Mon, Dec 05, 2022 at 09:39:29PM +0800, liulongfang wrote: >> On 2022/12/2 23:17, Jason Gunthorpe wrote: >>> On Fri, Dec 02, 2022 at 05:26:21PM +0800, Longfang Liu wrote: >>> >>>> +static ssize_t vfio_pci_vf_state_read(struct file *filp, char __user *buffer, >>>> + size_t count, loff_t *pos) >>>> +{ >>> >>> This would be better to use debugfs_create_devm_seqfile() >>> >>> Then you can simply use seq_printf() >>> >> >> The previous debugfs used this method in my patch. >> Is it now recommended to use the interface with "devm" ? > > It doesn't matter, the point is not the devm, it is to use the right > helper for the data you want to expose over debugfs > >>>> @@ -119,6 +129,8 @@ 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); >>> >>> Still no to passing through debugfs ops, create these files in the >>> driver. >>> >> >> If this part is also created and enabled in the device driver, why do we need >> to put this debugfs in the vfio public framework? > > To create the directory, and the few actually common files > OK, Only use the state as a public function, and create other debug files inside the driver. Thanks, Longfang. > Jason > . >