On Mon, Jul 04, 2016 at 06:16:08PM +0300, Michael S. Tsirkin wrote: > On Tue, Jun 21, 2016 at 03:47:30PM +0800, Peter Xu wrote: > > Instead of searching the device tree every time, one static variable is > > declared for the default system x86 IOMMU device. Also, some VT-d > > macros are replaced by x86 ones. > > > > Signed-off-by: Peter Xu <pet...@redhat.com> > > I think it's cleaner to just use object_resolve_path_type > with the X86 type. Error handling by exit is rather ugly, too: > if we need a singleton type, let's add one and have > generic code detect such errors.
I did a quick measurement on the old path resolving method, it's consuming >60us every time just to fetch the default IOMMU object (on my laptop, i7-4810MQ CPU @ 2.80GHz). Do you think it'll be better if we can avoid that? Currently there is no critical path that is using this get_default(), only by IEC notifiers. However that will still take some extra time during boot, or when the notifiers are triggered. I agree that we should better provide a more general interface for singleton semantic. But do you think it's okay I send another patch to do that after this series merged? Since I may need some more time reading the codes and IIUC it'll possibly be a very standalone patch related to QOM, and another patch to just let X86 IOMMU be the first user. Thanks, -- peterx