Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1443145imm; Wed, 8 Aug 2018 17:47:58 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyXlDkN3iJzcDib2EiQtuUPrsRhLTSnn0hnLPPrR6oFyTcll/IxNHDvT87UJ1hEeMBwcpSw X-Received: by 2002:a17:902:6bc5:: with SMTP id m5-v6mr4479693plt.274.1533775678067; Wed, 08 Aug 2018 17:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533775678; cv=none; d=google.com; s=arc-20160816; b=OA3JmJ6AGuhUFvk1AIRE42s0cAu5L66eLdlW2+xO1fkjIW5O/bccrx5gWPUo+8/9U9 AzpHIqE0olLfPZ/W7mm+TOrIuNkAd7vogFGjjW61SMSHhuU9S8O54bgakX2+Y1ifVC7G JCVBRbyrx+BKXQhcx7rzyoDG2XpDPp1MSPpq3fUYlGUBozk8LbELP73wql8vhLmarIvE XxG4NcAvXJlNH64L+bz6Dkq4XVZ+Q38ziLIIn45mUiJQ35zLvyliOgE8foaShjNxLh49 jWZtq3lal0lsa0OK4bDHMMIq0T11rFuhz1GXYOBypjrVSZHvRPZS9p7AKE+mZ5bViyU3 fmBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=ZJZidaKngjgyR+N5LHTroTCmvRNXfL/n2pUOThGtRLE=; b=i+SLz8VERWasFHToE5LFJNAIQ4ImVDQTQ6Uij3NB7X7NcHTkW69iOCWTQGkLb52PVe EVOc4ol08HPFacKBz8H81V5IUfjxtMYyMXZ+sn+Y8kmC+WBhXezSl/78ykv8laEVXvu5 TP2PWbN/2ILXblEIO5gmvds0Sy+O9S8QkxBAXLxgdQTjEMRTEvMMg2lQopEB0Vww+7sy xhPH0S+XnJRYcjpZILdcRvhwQSN9vRow6pFBUlGAnz9Sj32EuHuhEcQNRJuNRmHh0zkr mHSDTFdTj3nGjNwH4F0If4Guwt4cAjUrJdlZLz3d2nrd1LTBXpKQJcwHPBEzUJvLYfKq YzHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1-v6si4592399pls.476.2018.08.08.17.47.10; Wed, 08 Aug 2018 17:47:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731793AbeHIDHZ (ORCPT + 99 others); Wed, 8 Aug 2018 23:07:25 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10684 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727530AbeHIDHZ (ORCPT ); Wed, 8 Aug 2018 23:07:25 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 080E4B34D4ADB; Thu, 9 Aug 2018 08:45:14 +0800 (CST) Received: from [10.177.253.249] (10.177.253.249) by smtp.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.399.0; Thu, 9 Aug 2018 08:45:11 +0800 Subject: Re: [PATCH] net/9p/trans_virtio.c: decrease the refcount of 9p virtio device when removing it To: Dominique Martinet References: <5B6AA65E.3030907@huawei.com> <20180808083630.GB16121@nautica> <5B6AB081.6090608@huawei.com> <20180808094014.GA5585@nautica> CC: "akpm@linux-foundation.org" , "Eric Van Hensbergen" , Ron Minnich , "Latchesar Ionkov" , Greg Kurz , "Linux Kernel Mailing List" , From: piaojun Message-ID: <5B6B8E96.9070302@huawei.com> Date: Thu, 9 Aug 2018 08:45:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20180808094014.GA5585@nautica> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.253.249] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dominique, On 2018/8/8 17:40, Dominique Martinet wrote: > piaojun wrote on Wed, Aug 08, 2018: >> I try to remove 9pnet_virtio.ko by 'rmmod 9pnet_virtio' as I want to >> replace it without rebooting system. > > I do that all the time when testing, it works for me. > What exact kernel commit are you running? > My kernel commit id 6edf1d4cb0acde, and I replace the 9p code with 9p-next. And I wonder if this will work well? >> Here I have not mount 9pfs yet, so the refcount is still 0. >> >> Before rmmod: >> # lsmod | grep 9p >> 9pnet_virtio 20480 0 >> 9pnet 106496 1 9pnet_virtio >> virtio_ring 28672 5 virtio_scsi,9pnet_virtio,virtio_pci,virtio_blk,virtio_net >> virtio 16384 5 virtio_scsi,9pnet_virtio,virtio_pci,virtio_blk,virtio_net >> >> After rmmod: >> # lsmod | grep 9p >> 9pnet_virtio 20480 0 >> 9pnet 106496 1 9pnet_virtio >> virtio_ring 28672 5 virtio_scsi,9pnet_virtio,virtio_pci,virtio_blk,virtio_net >> virtio 16384 5 virtio_scsi,9pnet_virtio,virtio_pci,virtio_blk,virtio_net >> >> Normally 9pnet_virtio should be invisible after rmmod like this: >> # lsmod | grep 9p >> 9pnet 106496 0 > > Right, that obviously didn't work... > > But on the other hand, if I apply your commit and load/unload > 9pnet_virtio 5-10 times (I ran it in a loop) I get KASAN errors because > we put too many of these refs ; that doesn't happen without your patch > so it's apparently wrong. > I'm curious how that could make modprobe work better for you as well, it > shouldn't depend on that... > > Maybe `modprobe -r` might give a better error, or something in dmesg? > In my testing, `modprobe -r` has the same behavior with rmmod.