Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3895238pxb; Tue, 17 Nov 2020 06:24:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwu3ssnIzNAoMIoBCd6dsuKpiubiYGbrnIR7U6GVmZECXOdVUVvUaqnyDbxjX8ir3pSCxU7 X-Received: by 2002:a05:6402:1c99:: with SMTP id cy25mr21113149edb.283.1605623063799; Tue, 17 Nov 2020 06:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605623063; cv=none; d=google.com; s=arc-20160816; b=Tyb3HbSCauwM8Z+wASpHycq603MtEA3QliQvosXfe7TJ+ag65tyKSbqVE8V5/pPit+ ZKrgMrFWk363ZM6kkbTRCLaOtayH/1kRlv4FadGeAuH5HMPSt/c0RDcvNeOHTGl1wLhf hRsOyZooVAmpcs0E8ZawA7VBAD49sQ/QRoV+YtILBYlxY06t3K40PjaV4ET3TgVbI9T5 RYBR440NRuVEGPsMhmUY52eUXbj436uMD++iRE7RWDa2DUTEto91IkgMrDSqwvYEpk/b LWF2oQbkp65KK421fnhTmZr9/qVTOLyMEFG4k2upsve1D/MjTEqZHKOpQUV+ybKiWG/Q pM8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CzMT1+oVbQ9dwG/lsdpdD0JPtzFvgGD2Po3JeM77ORU=; b=QcTDGFeJeoIoibIMFq/r7QguSwdtpWHbPSDFf/DLtyQhizVrdQGVQ1sZod71j7nYEx wd0I8encV7vpxYoLLfAbhE/IXEPbcf4qG+W9wyfJE4lEgOJiVcWuz+DeIMDYI+eVK3eq WZqD8HjHeJiTlDO5BfdBgB9xDkzIiN4xaR10Gw/1fTsSonSM2wW1/zUTwsIaSlnMj7H3 TrE5UKt+UwWTCH2Kpyw2YYWiGSvqmhoIEMHD6w8zFlUhztTzsz6XqbuncQtRaJ7NC8pr H9S6LvjPiCXlo7sRncl46D0NlATp2QMhDPTYTGST7UHPrJ693VDJXCFdrzW1KOnDwLra eRBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BiCbd4er; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id da28si13794013edb.112.2020.11.17.06.24.00; Tue, 17 Nov 2020 06:24:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BiCbd4er; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728403AbgKQOQ3 (ORCPT + 99 others); Tue, 17 Nov 2020 09:16:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52444 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgKQOQ2 (ORCPT ); Tue, 17 Nov 2020 09:16:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605622587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CzMT1+oVbQ9dwG/lsdpdD0JPtzFvgGD2Po3JeM77ORU=; b=BiCbd4erfloJRjYmqj5iO1xiQ8fcFTPyCAm2hpMOBbVN+qtIVwJ832wFcM7dLMYEojw0Pk lKETl2DwTy6ibsoZSzEpStIQf/a+JxlFS5bSeByUCbn00rnSYnxZ5kbnYWkXqYuWLaspX0 /MWJK4R6yhoesYDpXHQTG1TSHXn2/ZY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-535-VVnynI-TOW2QgWnnPBGh_A-1; Tue, 17 Nov 2020 09:16:25 -0500 X-MC-Unique: VVnynI-TOW2QgWnnPBGh_A-1 Received: by mail-wm1-f71.google.com with SMTP id e15so1602776wme.4 for ; Tue, 17 Nov 2020 06:16:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CzMT1+oVbQ9dwG/lsdpdD0JPtzFvgGD2Po3JeM77ORU=; b=napJeJ9gnqaL+1UMHrDosm5sHpXZwBZ87JB/3WFBEbGzAIk6KVf8JRuRZwuYX3DoVu SRn2mh5CAff0QRF+fPOHkhZsWcYJ0cR+CbI/+lA1O5MIkWGddh6xzQF3V/yw1dZ1LUba wi2jnykyx5ZR2jMzrObi+PXs7IaN9Trs+OfHsNwdkqZWOSknCVXcMbA352QwEDKsOK6D rufatIqxNGbFYPbsuEMTn1JV3BqhwcCa9jPoUXSXr0uXesV5tVwGXITd/2wG9DpWGOko Ci41aVXeEvvCf7HPDQMBJlQjLIZ9fsFxRpsvW/E8vubmCrpLNQ0dkRtymfnoBJMG6t9x Or9Q== X-Gm-Message-State: AOAM533bYGerhlXfn+FFNDNfrqPC7jdVkdm1ETbH0b5F/5DRxmD+yf0T iCiYhwrce0anlCIRs4rrvQ4V2mM1FbsVbMawqnQP5UgN5J0TVfcCfOGldsPF0O89D7TdD4kCVHG krqAkc68yk2+hDL0Y34GVqV34 X-Received: by 2002:a7b:c195:: with SMTP id y21mr4676405wmi.138.1605622584205; Tue, 17 Nov 2020 06:16:24 -0800 (PST) X-Received: by 2002:a7b:c195:: with SMTP id y21mr4676379wmi.138.1605622583987; Tue, 17 Nov 2020 06:16:23 -0800 (PST) Received: from steredhat (host-79-17-248-175.retail.telecomitalia.it. [79.17.248.175]) by smtp.gmail.com with ESMTPSA id d3sm29797039wrg.16.2020.11.17.06.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 06:16:23 -0800 (PST) Date: Tue, 17 Nov 2020 15:16:20 +0100 From: Stefano Garzarella To: Stefan Hajnoczi Cc: virtualization@lists.linux-foundation.org, Laurent Vivier , linux-kernel@vger.kernel.org, Eli Cohen , Jason Wang , "Michael S. Tsirkin" , Max Gurtovoy Subject: Re: [PATCH RFC 04/12] vdpa: add vdpa simulator for block device Message-ID: <20201117141620.ytium7r6xpxi4and@steredhat> References: <20201113134712.69744-1-sgarzare@redhat.com> <20201113134712.69744-5-sgarzare@redhat.com> <20201117111121.GD131917@stefanha-x1.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20201117111121.GD131917@stefanha-x1.localdomain> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2020 at 11:11:21AM +0000, Stefan Hajnoczi wrote: >On Fri, Nov 13, 2020 at 02:47:04PM +0100, Stefano Garzarella wrote: >> +static void vdpasim_blk_work(struct work_struct *work) >> +{ >> + struct vdpasim *vdpasim = container_of(work, struct vdpasim, work); >> + u8 status = VIRTIO_BLK_S_OK; >> + int i; >> + >> + spin_lock(&vdpasim->lock); >> + >> + if (!(vdpasim->status & VIRTIO_CONFIG_S_DRIVER_OK)) >> + goto out; >> + >> + for (i = 0; i < VDPASIM_BLK_VQ_NUM; i++) { >> + struct vdpasim_virtqueue *vq = &vdpasim->vqs[i]; >> + >> + if (!vq->ready) >> + continue; >> + >> + while (vringh_getdesc_iotlb(&vq->vring, &vq->iov, &vq->iov, >> + &vq->head, GFP_ATOMIC) > 0) { >> + >> + int write; >> + >> + vq->iov.i = vq->iov.used - 1; >> + write = vringh_iov_push_iotlb(&vq->vring, &vq->iov, &status, 1); >> + if (write <= 0) >> + break; > >We're lucky the guest driver doesn't crash after VIRTIO_BLK_T_GET_ID? :) The crash could happen if the simulator doesn't put the string terminator, but in virtio_blk.c, the serial_show() initialize the buffer putting the string terminator in the VIRTIO_BLK_ID_BYTES element: buf[VIRTIO_BLK_ID_BYTES] = '\0'; err = virtblk_get_id(disk, buf); This should prevent the issue, right? However in the last patch of this series I implemented VIRTIO_BLK_T_GET_ID support :-) Thanks, Stefano