Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3925558pxb; Tue, 17 Nov 2020 07:07:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHxPZJKNqa84lXnZDHb42MO6P825axjDJqXJ9sSv9PsnVNy3Am8oMzfNS89oDz6EmkVlCQ X-Received: by 2002:a5d:5291:: with SMTP id c17mr25106316wrv.311.1605625677484; Tue, 17 Nov 2020 07:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605625677; cv=none; d=google.com; s=arc-20160816; b=w/C7nxOY+RC31iWfd89iLjC+ALJmz1ddtOi7EevVlE1HB9EuliFUWgeqCFPypmH4wS TwH1EVVEGWFtQCl+8K0/3nMjQRY6PhmTbdp8E2ZHjgFJs72OomwTGFcYjC1vUbpeZ/Oa NE5Y+i+pNPqLdiN3YmLBrTtEc0fLNlf+llTBa/MrZx2jOeHiHEiJAm47Km2/wSOlW+Hj 3AmasFu8H31jWtqm9TBxcEKcQfMMBnNDtrfWX410a5wCTuXotIEyZE7IKf/MCiw4zlYQ sb8rUMpcRVgXZ4ipUcOCSq768SlSl+nnAu0zLQ0M5OQ/NEx8MAMD9D5u9I+lFecUodYB UtMA== 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=C/nOqhucfZUlsIYVt0sm+AbfGVI1whVk4z8pbvaxmKA=; b=LQvgPPGQtn3zfKFy2IYo5eZHNHaeJiAANP0ny08iH0TYe/+ek7l6cnwLxypbdrXcUP wuzVT7vbx7H1ckwS9Ovvc2s8Ev9zjZWUwiLBugWnQcDXgShNuJjZhC0zyosSXcNea0Le aOXSWFkU3O8SuIZkiSNQ1lkZCZWoHfewsiTskg/U2OtCuQoYQxblF5A+HigkHrMR13ME nVJaPXpx62DwBIYM2t/RCV2KE0yr69IK8MsaO+E63ND6+yBr+j0Nr8N8cyweRx+PEdoJ z4LEccTsT8XhyRZfyZ6CClykYORJmWBu+sE1UdkzYWgqj6+Cv0+YwLjRGMq5UiCB5ro+ NpSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TCGYHLoN; 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 ce25si15624562edb.301.2020.11.17.07.07.33; Tue, 17 Nov 2020 07:07:57 -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=TCGYHLoN; 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 S1729747AbgKQPFc (ORCPT + 99 others); Tue, 17 Nov 2020 10:05:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21712 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729509AbgKQPFb (ORCPT ); Tue, 17 Nov 2020 10:05:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605625530; 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=C/nOqhucfZUlsIYVt0sm+AbfGVI1whVk4z8pbvaxmKA=; b=TCGYHLoN9sy/OeRcSOnWwNvpeYT5qUQNzni5dervMl/yUQVBVWgj3z3pq8jsUzHOm+fiaK 4jW/hiuyGLkIkC8gfEh9ekZRmROXI/KHiqNHdehOPi/cEyeNEPJN7c6fvcyL1d8lLf0VYd NcuGnvMHm6O9jfvoqhwFEGaCPBmg7vE= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-436-53UJA0tDPqmmqHnDD0IIOw-1; Tue, 17 Nov 2020 10:05:28 -0500 X-MC-Unique: 53UJA0tDPqmmqHnDD0IIOw-1 Received: by mail-wr1-f70.google.com with SMTP id f4so13147107wru.21 for ; Tue, 17 Nov 2020 07:05:28 -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=C/nOqhucfZUlsIYVt0sm+AbfGVI1whVk4z8pbvaxmKA=; b=LBVx2Gh18jc5wLOTPG+PteRfZhzHdGyycSYsTRDmolYdOoDKIAZgm0MNs4pYTRnBS2 xF6o8du2Wu06T06ZquWDR2uYMKXCpaXM6bHjHYCadTRa6CiB187P57YV9ICRvjhwgXPO WfErc+QiURaqSpMXll14QvS1mRQNSxmJrPr4pvheGi1QXNQ7mFeEXYYm7SOeFk4OAmf6 O1V2hs+V2Q9JXFu9PCRIufkR89+3SbIPBXAmiFXKHljJz5GbD2KT9EDGv34sm4kjPtPp A3PNbZ5wgwrU0KK1yvMI7+N5zuxNSYgOEY3MtR9E+m9g7rroHpauHL4bn69bA2Y1lJrz HKhQ== X-Gm-Message-State: AOAM5330NEHyzNpsauJ8Vbm8+h408nUVk7zQ7G8truzhaiSIQy6FkgUR upAhi6vzkWz6cZwHnu0c1U2rIxObNhWw340TleCJf3A2kCRJEBu0uwRds/GbGXOFLAtMil/hFEy KuQfGtA4YogTixQIpXAppO85o X-Received: by 2002:adf:e284:: with SMTP id v4mr27243148wri.271.1605625526852; Tue, 17 Nov 2020 07:05:26 -0800 (PST) X-Received: by 2002:adf:e284:: with SMTP id v4mr27243126wri.271.1605625526652; Tue, 17 Nov 2020 07:05:26 -0800 (PST) Received: from steredhat (host-79-17-248-175.retail.telecomitalia.it. [79.17.248.175]) by smtp.gmail.com with ESMTPSA id g23sm4050490wmh.21.2020.11.17.07.05.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 07:05:26 -0800 (PST) Date: Tue, 17 Nov 2020 16:05:23 +0100 From: Stefano Garzarella To: Stefan Hajnoczi , Jason Wang Cc: virtualization@lists.linux-foundation.org, Laurent Vivier , linux-kernel@vger.kernel.org, Eli Cohen , Jason Wang , Max Gurtovoy Subject: Re: [PATCH RFC 01/12] vhost-vdpa: add support for vDPA blk devices Message-ID: <20201117150523.berhqwtgqjov3i63@steredhat> References: <20201113134712.69744-1-sgarzare@redhat.com> <20201113134712.69744-2-sgarzare@redhat.com> <20201117105709.GC131917@stefanha-x1.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20201117105709.GC131917@stefanha-x1.localdomain> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2020 at 10:57:09AM +0000, Stefan Hajnoczi wrote: >On Fri, Nov 13, 2020 at 02:47:01PM +0100, Stefano Garzarella wrote: >> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c >> index 2754f3069738..fb0411594963 100644 >> --- a/drivers/vhost/vdpa.c >> +++ b/drivers/vhost/vdpa.c >> @@ -22,6 +22,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "vhost.h" >> >> @@ -194,6 +195,9 @@ static int vhost_vdpa_config_validate(struct vhost_vdpa *v, >> case VIRTIO_ID_NET: >> size = sizeof(struct virtio_net_config); >> break; >> + case VIRTIO_ID_BLOCK: >> + size = sizeof(struct virtio_blk_config); >> + break; >> } >> >> if (c->len == 0) > >Can vdpa_config_ops->get/set_config() handle the size check instead of >hardcoding device-specific knowledge into drivers/vhost/vdpa.c? I agree that this should be better. For example we already check if the buffer is large enough in the simulator callbacks, we only need to return an error in case it is not true. @Jason, do you think it's okay to add a return value to vdpa_config_ops->get/set_config() to handle the size check? Thanks, Stefano