From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 5/5 V2] kvm tools: Initialize and use VESA and VNC Date: Tue, 24 May 2011 11:10:04 +0200 Message-ID: <4DDB75EC.7000300@redhat.com> References: <1306149553-26793-1-git-send-email-levinsasha928@gmail.com> <1306149553-26793-5-git-send-email-levinsasha928@gmail.com> <20110523113824.GE4042@elte.hu> <4DDB6E55.8080408@redhat.com> <20110524085024.GA31453@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Sasha Levin , penberg@kernel.org, john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com To: Ingo Molnar Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38236 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755099Ab1EXJKf (ORCPT ); Tue, 24 May 2011 05:10:35 -0400 In-Reply-To: <20110524085024.GA31453@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: On 05/24/2011 10:50 AM, Ingo Molnar wrote: > Yeah, that would certainly work for simple things but there's several reasons > why explicit control over initcalls is preferred in a tool like tools/kvm/ over > __attribute__((constructor)): Some advantages you mention are real indeed, but they are general; there's no reason why they apply only to tools/kvm. You can achieve the same by doing only minimal work (registering your subsystems/devices/whatever in a linked list) in the constructors. Then you iterate on the list and call function pointers. I know portability is not relevant to tools/kvm/, but using unportable tricks for the sake of using them is a direct way to NIH. But oh well all of tools/kvm/ is NIH after all. :) > - The kernel has several classes of initcalls with different call priority, > i'm not aware of an equivalent __attribute__((constructor)) capability. > We could also do more sophisticated layers of initcalls or an explicit > initcall dependency tree, should the need arise. Constructors and destructors can have a priority (low runs first for constructors, low runs last for destructors). Paolo