Date: Fri, 28 Dec 2007 02:03:52 -0600 (CST) From: Mike Silbersack <silby@silby.com> To: current@freebsd.org Subject: [patch] Auto-setting hz to 100 inside QEMU/VMWare Message-ID: <20071228015651.X1565@odysseus.silby.com>
next in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1861302967-405513987-1198829032=:1565 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed When running FreeBSD inside QEMU / VMWare, one of my pet peeves is that time is completely inaccurate. This seems to be cured by setting kern.hz=100 (down from the default of 1000) in /boot/loader.conf, but I'm getting sick of doing that every time I set up a virtual box. So, here's a patch to have the kernel auto-detect that it's running inside one of those two environments and automatically make that adjustment. If you're running FreeBSD inside any other virtual environments (Parallels? Microsoft Virtual PC?) and can detect them via data in kenv, I'll be happy to add them to the patch as well. I have only tested this patch in QEMU so far, I will test inside VMWare tomorrow. If anyone could review and/or test this, it would be appreciated. Thanks, Mike "Silby" Silbersack --1861302967-405513987-1198829032=:1565 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=subr_param.c-100hz.patch Content-Transfer-Encoding: BASE64 Content-ID: <20071228020352.C1565@odysseus.silby.com> Content-Description: Content-Disposition: attachment; filename=subr_param.c-100hz.patch LS0tIC91c3Ivc3JjL3N5cy5vbGQva2Vybi9zdWJyX3BhcmFtLmMJMjAwNy0x Mi0xNiAwMTozNzozMy4wMDAwMDAwMDAgLTA2MDANCisrKyBrZXJuL3N1YnJf cGFyYW0uYwkyMDA3LTEyLTI4IDAyOjUxOjI4LjAwMDAwMDAwMCAtMDYwMA0K QEAgLTEwOCw4ICsxMDgsMjkgQEANCiB2b2lkDQogaW5pdF9wYXJhbTEodm9p ZCkNCiB7DQorCWNoYXIgKmVudnB0cjsNCiANCiAJaHogPSBIWjsNCisJLyog TmVpdGhlciBRRU1VIG9yIFZNV2FyZSBjYW4ga2VlcCB1cCB3aXRoIGd1ZXN0 cyBydW5uaW5nIGF0DQorCSAqIDEwMDAgaHouICBUaGlzIGxlYWRzIHRvIGhp Z2hseSBpbmFjY3VyYXRlIHRpbWVrZWVwaW5nIGJ5DQorCSAqIHRoZSBndWVz dC4gIFRvIHdvcmsgYXJvdW5kIHRoaXMsIGZvcmNlIDEwMCBoeiB3aGVuIHdl DQorCSAqIGRldGVjdCB0aGF0IHdlIGFyZSBhIGd1ZXN0IG9mIG9uZSBvZiB0 aGVzZSB0d28uDQorCSAqLw0KKwllbnZwdHIgPSBnZXRlbnYoImhpbnQuYWNw aS4wLm9lbSIpOw0KKwlpZiAoZW52cHRyKSB7DQorCQlpZiAobWVtY21wKGVu dnB0ciwgIlFFTVUiLCA0KSA9PSAwKQ0KKwkJCWh6ID0gMTAwOw0KKwkJZnJl ZWVudihlbnZwdHIpOw0KKwkJZW52cHRyID0gTlVMTDsNCisJfQ0KKwllbnZw dHIgPSBnZXRlbnYoInNtYmlvcy5zeXN0ZW0ubWFrZXIiKTsNCisJaWYgKGVu dnB0cikgew0KKwkJaWYgKG1lbWNtcChlbnZwdHIsICJWTXdhcmUsIEluYy4i LCAxMikgPT0gMCkNCisJCQloeiA9IDEwMDsNCisJCWZyZWVlbnYoZW52cHRy KTsNCisJCWVudnB0ciA9IE5VTEw7DQorCX0NCisJCQ0KIAlUVU5BQkxFX0lO VF9GRVRDSCgia2Vybi5oeiIsICZoeik7DQogCXRpY2sgPSAxMDAwMDAwIC8g aHo7DQogDQo= --1861302967-405513987-1198829032=:1565--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071228015651.X1565>