Bug 785291

Summary: boot speedup: don't execute grep in kvm.modules [PATCH]
Product: [Fedora] Fedora Reporter: Will Woods <wwoods>
Component: qemuAssignee: Justin M. Forbes <jforbes>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: amit.shah, berrange, cfergeau, clalancette, dougsland, dwmw2, ehabkost, extras-orphan, gcosta, itamar, jaswinder, jforbes, knoel, markmc, notting, quintela, scottt.tw, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-09 20:36:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Will Woods 2012-01-27 21:35:39 UTC
/etc/sysconfig/modules/kvm.modules runs 'grep' twice to see if the CPU supports VMX or SVM. This can be handled without calling out to external programs, like so:

#!/bin/bash

case "$(</proc/cpuinfo)" in
    *vmx*) vmx=1 ;;
    *svm*) svm=1 ;;
esac

[ "$vmx" ] && modprobe -b kvm-intel >/dev/null 2>&1
[ "$svm" ] && modprobe -b kvm-amd >/dev/null 2>&1
[ "$vmx" -o "$svm" ] && modprobe -b virtio-net >/dev/null 2>&1

Sure, it's minor, but it's faster and functionally equivalent. Can't hurt, right?

Comment 1 Justin M. Forbes 2012-02-09 20:36:14 UTC
Thanks, it might be minor, but it is appreciated.  This will make the next releases.