qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] SCSI bus: fix to incomplete QOMify


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] SCSI bus: fix to incomplete QOMify
Date: Mon, 11 Jan 2016 18:37:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> On 07/01/2016 10:53, Cao jin wrote:
>> On 01/07/2016 05:38 PM, Paolo Bonzini wrote:
>>> On 06/01/2016 14:43, Cao jin wrote:
>>> These functions are called in the data path; changes to use SCSI_BUS()
>>> should come with performance data proving that it doesn't slow down I/O.
>>>
>> 
>> I see. I am not familiar with the procedure of scsi i/o performance
>> test, do have some guideline about it?
>
> Usually people test with FIO, but I think it's simpler to just keep
> DO_UPCAST here.

DO_UPCAST() needs to die.

SCSI_BUS() is a readable wrapper around OBJECT_CHECK():

    #define SCSI_BUS(obj) OBJECT_CHECK(SCSIBus, (obj), TYPE_SCSI_BUS)

OBJECT_CHECK() is semantically a type cast, but in actual code it does
more:

    #define OBJECT_CHECK(type, obj, name) \
        ((type *)object_dynamic_cast_assert(OBJECT(obj), (name), \
                                            __FILE__, __LINE__, __func__))

    Object *object_dynamic_cast_assert(Object *obj, const char *typename,
                                       const char *file, int line, const char 
*func)
    {
        trace_object_dynamic_cast_assert(obj ? obj->class->type->name : 
"(null)",
                                         typename, file, line, func);

    #ifdef CONFIG_QOM_CAST_DEBUG
    [...]
    #endif
        return obj;
    }

If CONFIG_QOM_CAST_DEBUG is on, it checks.  That's a feature.

If CONFIG_QOM_CAST_DEBUG is off, it still calls to trace.  That might
be a misfeature.

If OBJECT_CHECK() isn't fit for fast paths because of that, perhaps QOM
should provide a conversion macro that is.  Andreas, what do you think?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]