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 X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF0D1C43333 for ; Tue, 26 Jan 2021 17:09:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BBD620829 for ; Tue, 26 Jan 2021 17:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388108AbhAZRGd (ORCPT ); Tue, 26 Jan 2021 12:06:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47502 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389712AbhAZIMG (ORCPT ); Tue, 26 Jan 2021 03:12:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611648636; h=from:from: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; bh=djhTRJGJg3J6BeW0ceDPJuujST4T2Jt9ExZ596qYokQ=; b=evDxedQj6ZvVB7RZnWuriP/fMNKoZ9lTAlAe2CWemnHDplELSLSXgkgREzt2tC2UlMiJmf jL7RQvs1ToIXejBQSh+GGZlCCW6KiHzImSMQ6AqnJqhkvgrTW1ZHkTXnptS25L9y0H5EAU ehijplBgPmpOG1FEesNDFfV5BWk4+1w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-9NkikARFNxGCYD4QHeGSrw-1; Tue, 26 Jan 2021 03:10:32 -0500 X-MC-Unique: 9NkikARFNxGCYD4QHeGSrw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1FF51005D6E; Tue, 26 Jan 2021 08:10:17 +0000 (UTC) Received: from [10.72.12.70] (ovpn-12-70.pek2.redhat.com [10.72.12.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C5EE77BE1; Tue, 26 Jan 2021 08:09:48 +0000 (UTC) Subject: Re: [RFC v3 10/11] vduse: grab the module's references until there is no vduse device To: Xie Yongji , mst@redhat.com, stefanha@redhat.com, sgarzare@redhat.com, parav@nvidia.com, bob.liu@oracle.com, hch@infradead.org, rdunlap@infradead.org, willy@infradead.org, viro@zeniv.linux.org.uk, axboe@kernel.dk, bcrl@kvack.org, corbet@lwn.net Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, kvm@vger.kernel.org, linux-aio@kvack.org, linux-fsdevel@vger.kernel.org References: <20210119045920.447-1-xieyongji@bytedance.com> <20210119050756.600-1-xieyongji@bytedance.com> <20210119050756.600-4-xieyongji@bytedance.com> From: Jason Wang Message-ID: <406479e4-a4f8-63f3-38f5-b1c3bb6e31ab@redhat.com> Date: Tue, 26 Jan 2021 16:09:47 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210119050756.600-4-xieyongji@bytedance.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 2021/1/19 下午1:07, Xie Yongji wrote: > The module should not be unloaded if any vduse device exists. > So increase the module's reference count when creating vduse > device. And the reference count is kept until the device is > destroyed. > > Signed-off-by: Xie Yongji Looks like a bug fix. If yes, let's squash this into patch 8. Thanks > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c > index 4d21203da5b6..003aeb281bce 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -978,6 +978,7 @@ static int vduse_destroy_dev(u32 id) > kfree(dev->vqs); > vduse_domain_destroy(dev->domain); > vduse_dev_destroy(dev); > + module_put(THIS_MODULE); > > return 0; > } > @@ -1022,6 +1023,7 @@ static int vduse_create_dev(struct vduse_dev_config *config) > > dev->connected = true; > list_add(&dev->list, &vduse_devs); > + __module_get(THIS_MODULE); > > return fd; > err_fd: