From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxIAs-0004pf-7Z for qemu-devel@nongnu.org; Wed, 18 Jun 2014 11:53:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxIAl-0002BL-SH for qemu-devel@nongnu.org; Wed, 18 Jun 2014 11:53:21 -0400 Message-ID: <53A1B5DF.7020303@redhat.com> Date: Wed, 18 Jun 2014 17:53:03 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1403105553-5478-1-git-send-email-ming.lei@canonical.com> <20140618154335.GA25619@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1] virtio-scsi: fix object check failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ming Lei , "Michael S. Tsirkin" Cc: Peter Maydell , qemu-devel@nongnu.org, Anthony Liguori , qemu-stable@nongnu.org Il 18/06/2014 17:48, Ming Lei ha scritto: > On Wed, Jun 18, 2014 at 11:43 PM, Michael S. Tsirkin wrote: >> On Wed, Jun 18, 2014 at 11:32:33PM +0800, Ming Lei wrote: >>> In case of vhost-scsi, the object type of VirtIODevice isn't >>> VirtIOSCSI, so use the cast trick to fix the problem like >>> in virtio_scsi_handle_cmd(). >>> >>> Also 'events_dropped' need to be accessed in the path, >> >> in which path? > > I mean vq's notify path, virtio_scsi_handle_event(). A better way is this: - create a VirtIOSCSICommonClass struct and use it (virtio_scsi_common_info) - add three members virtio_scsi_handle_ctrl, virtio_scsi_handle_event, virtio_scsi_handle_cmd to VirtIOSCSICommonClass - initialize them to the existing functions in virtio_scsi_class_init - initialize them to dummy empty functions in vhost_scsi_class_init Which I should have done in the first place when rebasing vhost-scsi, and I didn't only because I was lazy and thought this could not happen. :( Turns out it only didn't because at the time the kernel did not support events. Paolo