From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [KVM-AUTOTEST PATCH] Instead of trying to remove kvm modules with rmmod, use modprobe -r, as it handles module dependencies better Date: Sun, 24 May 2009 17:54:51 +0300 Message-ID: <4A195FBB.4070508@redhat.com> References: <1242338026.2554.44.camel@localhost.localdomain> <4A12EBAF.7080302@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Lucas Meneghel Rodrigues , kvm@vger.kernel.org To: mburns@redhat.com Return-path: Received: from mx2.redhat.com ([66.187.237.31]:56114 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753479AbZEXOyv (ORCPT ); Sun, 24 May 2009 10:54:51 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n4OEsr6B018263 for ; Sun, 24 May 2009 10:54:53 -0400 In-Reply-To: <4A12EBAF.7080302@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Mike Burns wrote: > Lucas Meneghel Rodrigues wrote: > >> In certain situations, trying to do a rmmod on the kvm modules might >> generate errors, as there is a chain of dependencies involved. Instead, >> let's use modprobe -r, as it handles dependencies. >> >> Signed-off-by: Lucas Meneghel Rodrigues >> >> diff --git a/client/tests/kvm_runtest_2/kvm_install.py b/client/tests/kvm_runtes >> index dbf8401..c27c6c7 100755 >> --- a/client/tests/kvm_runtest_2/kvm_install.py >> +++ b/client/tests/kvm_runtest_2/kvm_install.py >> @@ -192,9 +192,9 @@ def __load_kvm_modules(): >> #utils.system("pkill qemu 1>/dev/null 2>&1", ignore_status=True) >> utils.system("pkill qemu", ignore_status=True) >> #if utils.system("grep kvm_%s /proc/modules 1>/dev/null" % vendor, ignore_s >> - utils.system("/sbin/rmmod kvm_%s" % vendor, ignore_status=True) >> + utils.system("/sbin/modprobe -r kvm_%s" % vendor, ignore_status=True) >> #if utils.system("grep kvm /proc/modules 1>/dev/null", ignore_status=True) >> - utils.system("/sbin/rmmod kvm", ignore_status=True) >> + utils.system("/sbin/modprobe -r kvm", ignore_status=True) >> >> if utils.system("grep kvm /proc/modules 1>/dev/null", ignore_status=True) = >> message = "Failed to remove old KVM modules" >> >> >> > In normal situations, this works perfectly fine. It also suppresses the > output to stderr if a module is not already loaded on the machine. > Errors are are still encountered, however, if another module is > installed that depends on one of the modules kvm_install is trying to > remove. In my environment, I have a module, ksm, which depends on kvm > being loaded. If I modprobe -r kvm, them it will fail saying "Module > kvm is in use". Overall, this is a minimal impact change that doesn't > cause any problems, but it doesn't seem to address the initial problem > of having other modules that depend on one of the kvm modules. > Ignoring status is a recipe for disaster. Instead we should check if the modules are loaded and only unload then (and fail if we can't). -- error compiling committee.c: too many arguments to function