From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4E573587CB for ; Wed, 19 Nov 2025 12:35:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763555709; cv=none; b=Kv3Iu0ct0d7N2v0+4OAhJLYm+n/kUSyJCCQ86tGyS5NIfhsGokKTrlkib/zy+quwHhtMkeA1z3+VxujPCFhYQ0u23PVU1ShpUteW5J4z2pY6Ol+GdJ+Mt3b7UWY9tAxl+MSErKWgZbRY4R8l1oDeFWRFCOe/J7L45bfrM2/hofQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763555709; c=relaxed/simple; bh=EPmrUepgE1rgeLfHqD5slhvdiL6tMO9t2cr77eQyKts=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RprSfm36Lde/UmgEfyPRw2CEWbHASk2lTvvR8bsVYfPNBNGB2g9lWkpEc4ujKQf4OLkVWhFJw34ABfBvANrjdHVXpcmOAcECO7eC65/q5+LDTzh86E/xjoJrOFSqVo/lVGazxO7kNF7+3M2yTybbv+qC3ugQFaZAyb/3+vP5zas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Y0j+n6mo; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=OpFj9bVR; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y0j+n6mo"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="OpFj9bVR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763555705; 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=cX3V/Maq1P62aubbfEZMkx/73yOAMpSFaKpbQ5l618w=; b=Y0j+n6moUkptffLGrnn3nt9m9vC8WA7dualthxVUXZ2ce6gZa3mCVM8Ylm00/1OIflUbvw vpDBv0uWVxDIFp4zjnSAFY9DCff/A37cxuhliFPyR76CxiEZSFGAswruk6AHBx8qrjp38d ZKNLFT6llztvKboDuOiOHXiueGnSWOk= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-480-5OLjKCQNPDankl_IgwQAsQ-1; Wed, 19 Nov 2025 07:35:03 -0500 X-MC-Unique: 5OLjKCQNPDankl_IgwQAsQ-1 X-Mimecast-MFC-AGG-ID: 5OLjKCQNPDankl_IgwQAsQ_1763555702 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-42b3ed2c3e3so4578318f8f.1 for ; Wed, 19 Nov 2025 04:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763555701; x=1764160501; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cX3V/Maq1P62aubbfEZMkx/73yOAMpSFaKpbQ5l618w=; b=OpFj9bVR2mnYp80kl8qp0X6YeSVRM2dAHTCcC1DsYOSQ2eyerDU+3vcQ5IjDq7wyup hUTOfNO8BCEusKNg5gqh4iopxldMu1KqiboKz89gT0luKEOfn6odTAMAjlXbhXqZS3RO pK0neFXyiZ/MUOhi0CPj5KMl+LZ10VfX4oayFir4/a3gOXd7eHB7QZlsRKhlPMcpGBXE UVMYUHIUZVH844kPNz+mZOXVk+ARphTnI+ISsnIQm4O7Jsdc8afWCElJWhLOhjBP3gPy NYko7Ezka0T/FTcjMqB+D+BRI50On2hFvn3quwTx/7rirQo2IoCzmJ+sekm+rm2GDaVB xiTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763555701; x=1764160501; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cX3V/Maq1P62aubbfEZMkx/73yOAMpSFaKpbQ5l618w=; b=exiov19xHt0uULqIysn0zCpvU9xbp3I4TNjw/SyUFFO/T2KtIL8cS4mtBxFwCqVu+A Uwx2XBoVW+3UIq2Fs0F01xPe5OuQCHFwtGL2Ml0rxAN1pwEA7khP2YLRz1HiPW6cs5BA ca7W+LrVqDesXQB+qYc6CJjQl4SjwdA8cmSLkM5yfPcpzK8naZcBvzvmug0lJwjfzGDP P2Ik4oNUwMUWL/bBcGpDl+Gv0ZQm0FoAnus6m4FfJwmHj093a0EE4/RWsJiC88bi5Epl iiRteGXtRIsF0QPirRkJPdVfNwtmJTwvrgGYcRSDMIFToHRcQrGa25RzzKlQYYt6jiRP RRdQ== X-Gm-Message-State: AOJu0Yw0aWewoDAnqfYFaRrSFkYOlQ++WVmt+n0cEYc3dzu+R6fWsc7L E6rlz4e+SpXD5/J0pQzrNEjYjb6eCNAzDlq9yl8Ofb6z2foq5oA3R5giuscpNwLxSPbdFtcRwUY bPjbmG+ssT/lHhcfSA3IcIY4jXWWtMOhepzvyjMlfZmfdQoC9ji77WCKJ67jsoYJw6w== X-Gm-Gg: ASbGnctF8CdeTyYVt6pYsZ4hA0jwedMqB40KSMjkN0lgDyo7bLVRoFSYpayzHllhDvO UeRvlPO3MvIN9Io53FRCtbQZWBEFfYRA9BAy7rRpc0eJ1maxhySgx9FSoJd6f00SIiQf5sFJJ6J 0hFeqkS5zZ8jsDQ0sx+ffL0gVdBCb7yZWojUYbdMPBBuU9LMsFinqya/yqmvUNCHIpt3B1xJofr 9yt7uFNMBvEiY8qcDVNNXpV+3SPYNHr5nKA8BzL2DT+FQfp4+WKYb2CkQ9KmdZLaeMco+5IntQJ 9xqLvsPwvWaVIbLWqS3wnEzIWJTJJ7Y5kKsaXuOymlTQ9tBYytF0RZdb7c4GhlOZENtetSw0j0M Tz7eDcNYfVVLBlgnLDsRQ0eHYbPgk0Q== X-Received: by 2002:a05:6000:2c05:b0:42b:4177:7135 with SMTP id ffacd0b85a97d-42b593721efmr18718647f8f.41.1763555701528; Wed, 19 Nov 2025 04:35:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZDtCaU9W4jbuIEbB8KCRjqHZi966/jHceca8fTLxnbGRC0wWJ1uQzXqWj/dl06f43gIEXkg== X-Received: by 2002:a05:6000:2c05:b0:42b:4177:7135 with SMTP id ffacd0b85a97d-42b593721efmr18718600f8f.41.1763555701078; Wed, 19 Nov 2025 04:35:01 -0800 (PST) Received: from redhat.com (IGLD-80-230-39-63.inter.net.il. [80.230.39.63]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f174afsm36933997f8f.33.2025.11.19.04.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 04:35:00 -0800 (PST) Date: Wed, 19 Nov 2025 07:34:57 -0500 From: "Michael S. Tsirkin" To: Paolo Abeni Cc: linux-kernel@vger.kernel.org, Andrew Lunn , Jason Wang , Eugenio =?iso-8859-1?Q?P=E9rez?= , Xuan Zhuo , Jonathan Corbet , kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-doc@vger.kernel.org, Mike Christie , Paolo Bonzini , Stefan Hajnoczi , Stefano Garzarella Subject: Re: [PATCH v5 2/2] vhost: switch to arrays of feature bits Message-ID: <20251119073155-mutt-send-email-mst@kernel.org> References: <4204ed4b-0da1-407f-84e0-e23e2ce65fc7@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4204ed4b-0da1-407f-84e0-e23e2ce65fc7@redhat.com> On Wed, Nov 19, 2025 at 12:04:12PM +0100, Paolo Abeni wrote: > On 11/19/25 7:55 AM, Michael S. Tsirkin wrote: > > @@ -1720,6 +1720,7 @@ static long vhost_net_set_owner(struct vhost_net *n) > > static long vhost_net_ioctl(struct file *f, unsigned int ioctl, > > unsigned long arg) > > { > > + const DEFINE_VHOST_FEATURES_ARRAY(features_array, vhost_net_features); > > I'm sorry for the late feedback, I was drowning in other stuff. > > I have just a couple of non blocking suggestions, feel free to ignore. > > I think that if you rename `vhost_net_features` as > `vhost_net_features_bits` and `features_array` as `vhost_net_features` > the diffstat could be smaller and possibly clearer. > > > u64 all_features[VIRTIO_FEATURES_U64S]; > > struct vhost_net *n = f->private_data; > > void __user *argp = (void __user *)arg; > > @@ -1734,14 +1735,14 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, > > return -EFAULT; > > return vhost_net_set_backend(n, backend.index, backend.fd); > > case VHOST_GET_FEATURES: > > - features = vhost_net_features[0]; > > + features = VHOST_FEATURES_U64(vhost_net_features, 0); > > Here and below you could use directly: > > features = features_array[0]; Ah. Good point. > if you apply the rename mentioned above, this chunk and the following 3 > should not be needed. > > [...]> diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c > > index 42c955a5b211..af727fccfe40 100644 > > --- a/drivers/vhost/test.c > > +++ b/drivers/vhost/test.c > > @@ -308,6 +308,12 @@ static long vhost_test_set_backend(struct vhost_test *n, unsigned index, int fd) > > return r; > > } > > > > +static const int vhost_test_features[] = { > > + VHOST_FEATURES > > +}; > > + > > +#define VHOST_TEST_FEATURES VHOST_FEATURES_U64(vhost_test_features, 0) > > If you rename `VHOST_FEATURES` to `VHOST_FEATURES_BITS` and > `VHOST_TEST_FEATURES` to `VHOST_FEATURES`, This one I don't want to do, people tend to copy/paste code and this is not what devices should be doing. > the following two chunks > should not be needed. > > Thanks, > > Paolo