Received: from eggs.gnu.org ([2001:4830:134:3::10]:59221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIgPH-0006S8-Kg for qemu-devel@nongnu.org; Mon, 11 Jan 2016 12:37:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIgPD-0006yY-Kq for qemu-devel@nongnu.org; Mon, 11 Jan 2016 12:37:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIgPD-0006yS-FX for qemu-devel@nongnu.org; Mon, 11 Jan 2016 12:37:23 -0500 From: Markus Armbruster References: <1452087782-980-1-git-send-email-caoj.fnst@cn.fujitsu.com> <568E320E.9@redhat.com> <568E35A7.4060403@cn.fujitsu.com> <568E5476.9010002@redhat.com> Date: Mon, 11 Jan 2016 18:37:20 +0100 In-Reply-To: <568E5476.9010002@redhat.com> (Paolo Bonzini's message of "Thu, 7 Jan 2016 13:05:10 +0100") Message-ID: <87lh7wt3u7.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] SCSI bus: fix to incomplete QOMify List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Cao jin , qemu-devel@nongnu.org, =?utf-8?Q?Andreas_F=C3=A4rber?= Paolo Bonzini 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?