Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2333897lqz; Tue, 2 Apr 2024 14:16:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAel4dz0DMm2ocoTdA8YxovTEEfVCVOIJIpVuhNugLee6VE3xvntLEMOVx5zCOABEm/mBOUIZU+baAZt3BP2slzkEYkxYDZg68E0KwCA== X-Google-Smtp-Source: AGHT+IHRolXA2fFd3I9Z01eGxZ361P7p7e35zQVK8uXptW21gw3OE9lo8UQq9sqJZNznNmDD9e3s X-Received: by 2002:a17:903:11cc:b0:1df:fa1a:529f with SMTP id q12-20020a17090311cc00b001dffa1a529fmr13483698plh.24.1712092573488; Tue, 02 Apr 2024 14:16:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712092573; cv=pass; d=google.com; s=arc-20160816; b=GB1oLl95mzojpZuIuwdnpv1ip6gXNmt+gqEVwPWaheOaAo6XmqJaxtPeuuaPOeg/sw evSGe8z+m5cNEILnDdpDSiGyZMQxkHugphvENQFiMDcLNhkSEkIpvG7ozBhzsC3Z33IQ YVoCFBzMmJOLObSUAwlrEM6dn7RUr784rfl8ec7tVEMN3WWEFH86HNEdPScpzkRU6TXa A0oZ8qJ37wlEabJFRLWswm8EBCi3myWRI8BmUtcupo2QIsul4NvLxiaiciy4IXUujGdi 3q1XwbExwTMq6CbtYUXGFWFMnYhhHuc258f+f5KycsKeTo4O70DyfHcd5bzouvj4GMpA Rf7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YauaqpkrhxRbKvVylgbrqgv+lTFltW5WE3450/rVgy8=; fh=YgN+7Rw1OpdmGKIuaRwpZae+sxomIIoKSSFahrItboo=; b=XxkHOD7efkaq/9km0ktxdJ1o4SNjhB/aBRQxkGlMpxycEd5mv8MEdTI+A4EJpPJjTH z0xgd5JeCfF9FI4wsVYuoZFegpq2khaQp+3ZVUISXK8QaRDBYI/y4JEmBkIOrvnv7Sx3 7BdUWhImMGOmPhyP96Q/OZnYXZeLiTdQ69xdp0uLm12R6hka8kOAdDHjnH3sxCj0SHUA 4v/4ZodGRlZWCbIpvPPNbdSpGJczAU2WsedAs6JnTcjiers0qQTq2Uh0jpJK23LJk6I/ 6umPtZfODvbWpsB/FyXp+7FT0EOi3D704z4U8jby8BPDX/rYHePZjGexNsQ5ERtSe27t 72jA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="adG/5T0X"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-128710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n17-20020a170902d2d100b001e2708e421bsi1874068plc.227.2024.04.02.14.16.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 14:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="adG/5T0X"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-128710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 235752878DB for ; Tue, 2 Apr 2024 21:16:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CB8115E5A8; Tue, 2 Apr 2024 21:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="adG/5T0X" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 B602915ADB1 for ; Tue, 2 Apr 2024 21:16:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712092565; cv=none; b=TKVvuuWGmW5j0kjVmb1qoC0ITLQ0m3G7xcAdjoUPdR3DOR9hQZPy4PD70He3aqOCtAhDNPDAo7MlfPSjz3dqJ5dQf42COKG+b6CZr4KavtTm/to+V+ISaTZ89832BSyMhm7TB81Lxh9f85Tuuf4+Kc6kOphETIxFyBjafpKcitA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712092565; c=relaxed/simple; bh=hzooCVZc2LI/R+f/afiRVcNmo13hiN1rKNxBb/t2wYo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EKin7Ja+dm9fiZdhW9OODy6iE8VH+FG4O3IaNLWu6mhi8dc/GzujG/8lKblw8VNDiHLtlmHlKALc9krOBX8c4e73s1rn9x5D/UbAff7FCJZszjkAUTaC7Gwlb2AjjyUSAXBOE6W/O7RxL0rENk/7tKEyJ5R2NWeKB/IyTh5OvcI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=adG/5T0X; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712092559; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YauaqpkrhxRbKvVylgbrqgv+lTFltW5WE3450/rVgy8=; b=adG/5T0XJVNqKZ8f+RjtOaYzv5OTXKvynS9gLlkre5vb5saPwxq8ObFpoHgYuya9Ff6hDK AKuxqwMfJR0NyIwC9+3ID2zlVNMEgay48QDF7gfDzKQ8Ueywpq5f/kMfC4za501iY+S2Cp +FLYbRavYkr26yRJYKHwPuWX1EGOCiw= 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-55-APf3oiDSN_OEvl4soMltFg-1; Tue, 02 Apr 2024 17:15:58 -0400 X-MC-Unique: APf3oiDSN_OEvl4soMltFg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-341678a510bso3606420f8f.1 for ; Tue, 02 Apr 2024 14:15:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712092556; x=1712697356; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YauaqpkrhxRbKvVylgbrqgv+lTFltW5WE3450/rVgy8=; b=sa0cykBpwJIogiTYoDM9bmO4hfso+/KK77q4eqdEMmNn/jttxCt0YLxVgk1rd0+0Rt sK0V9QBvGMlDCmtjeMDNRVVuMFUCkrRjw/fUTfYW5UHtPfEIljbnIflFoCI1LhLxkuuF s0pcYI1pu+BBZqrskzpHeUAV/gOGwnNuOUc2iemClpNx7hSYWv4DiFQcbWZ5woX++XYR 9q3n19jqZHwPABBsu9+OSme0la9gQmZ0eG944YyKFJfEXsnw0stOQnBkzOjhIE04qc/O DDdpibwK5Dv6Vadj3Aj30Af8VMWsrPSpL7DfC+b3G6OVrp/IA6m0H5v4e1v8SPXBVZIo nI2Q== X-Forwarded-Encrypted: i=1; AJvYcCWGwPSdlQN8pz4SSXHYiUvRypDTbpsd/G9QPg1juAyjwWlJzo63Be8Mbrz3JSf4uHVehLzGbKbo/oClM3+69a0eI4bYIHfrP4gMDz8a X-Gm-Message-State: AOJu0YxP7KksIEihYXWhhfF+P6rAquj+EWclxtqZGXByvJRL9ove27eb 5+Ig6e+/ixtXQcDeaA48EEZ1gM9KMdpkNcVhqqFuaaWvzRDVM53/ZNWcM4zg+/h/wz7TRnCEGX0 bs8B/Dwr+o0VS2R45ZaSg87buYshEobSiRq7QOp+29KMSKUR8hcOGwTQhQa2FhtJt6A0uEkDg X-Received: by 2002:a05:6000:1548:b0:343:4727:d11e with SMTP id 8-20020a056000154800b003434727d11emr6791922wry.47.1712092556122; Tue, 02 Apr 2024 14:15:56 -0700 (PDT) X-Received: by 2002:a05:6000:1548:b0:343:4727:d11e with SMTP id 8-20020a056000154800b003434727d11emr6791904wry.47.1712092555590; Tue, 02 Apr 2024 14:15:55 -0700 (PDT) Received: from redhat.com ([2.52.21.244]) by smtp.gmail.com with ESMTPSA id b12-20020a5d4b8c000000b00343723c126asm2116005wrt.48.2024.04.02.14.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 14:15:55 -0700 (PDT) Date: Tue, 2 Apr 2024 17:15:51 -0400 From: "Michael S. Tsirkin" To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Adrian Hunter , Ian Rogers , Jiri Olsa , Kan Liang , Zhu Lingshan , Jason Wang Subject: Re: [PATCH fyi 1/1] perf trace beauty: Sync linux/vhost.h with the kernel sources Message-ID: <20240402170955-mutt-send-email-mst@kernel.org> References: 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Apr 02, 2024 at 02:04:39PM -0700, Namhyung Kim wrote: > On Thu, Mar 21, 2024 at 1:41 PM Arnaldo Carvalho de Melo > wrote: > > > > tldr; Just FYI, I'm carrying this on the perf tools tree. > > Have you applied this to perf-tools-next? > > > > > Full explanation: > > > > There used to be no copies, with tools/ code using kernel headers > > directly. From time to time tools/perf/ broke due to legitimate kernel > > hacking. At some point Linus complained about such direct usage. Then we > > adopted the current model. > > > > The way these headers are used in perf are not restricted to just > > including them to compile something. > > > > There are sometimes used in scripts that convert defines into string > > tables, etc, so some change may break one of these scripts, or new MSRs > > may use some different #define pattern, etc. > > > > E.g.: > > > > $ ls -1 tools/perf/trace/beauty/*.sh | head -5 > > tools/perf/trace/beauty/arch_errno_names.sh > > tools/perf/trace/beauty/drm_ioctl.sh > > tools/perf/trace/beauty/fadvise.sh > > tools/perf/trace/beauty/fsconfig.sh > > tools/perf/trace/beauty/fsmount.sh > > $ > > $ tools/perf/trace/beauty/fadvise.sh > > static const char *fadvise_advices[] = { > > [0] = "NORMAL", > > [1] = "RANDOM", > > [2] = "SEQUENTIAL", > > [3] = "WILLNEED", > > [4] = "DONTNEED", > > [5] = "NOREUSE", > > }; > > $ > > > > The tools/perf/check-headers.sh script, part of the tools/ build > > process, points out changes in the original files. > > > > So its important not to touch the copies in tools/ when doing changes in > > the original kernel headers, that will be done later, when > > check-headers.sh inform about the change to the perf tools hackers. > > > > To get the changes in: > > > > 1496c47065f9f841 ("vhost-vdpa: uapi to support reporting per vq size") > > > > To pick up these changes and support them: > > > > $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > before > > $ cp include/uapi/linux/vhost.h tools/perf/trace/beauty/include/uapi/linux/vhost.h > > $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > after > > $ diff -u before after > > --- before 2024-03-21 17:33:58.878173388 -0300 > > +++ after 2024-03-21 17:34:07.687563333 -0300 > > @@ -49,6 +49,7 @@ > > [0x7B] = "VDPA_GET_VRING_GROUP", > > [0x7F] = "VDPA_GET_VRING_DESC_GROUP", > > [0x80] = "VDPA_GET_VQS_COUNT", > > + [0x80] = "VDPA_GET_VRING_SIZE", > > This gives me a build error: > > CC trace/beauty/ioctl.o > In file included from trace/beauty/ioctl.c:93: > linux/tools/perf/trace/beauty/generated/ioctl/vhost_virtio_ioctl_array.c: > In function ‘ioctl__scnprintf_vhost_virtio_cmd’: > linux/tools/perf/trace/beauty/generated/ioctl/vhost_virtio_ioctl_array.c:53:18: > error: initialized field overwritten [-Werror=override-init] > 53 | [0x80] = "VDPA_GET_VRING_SIZE", > | ^~~~~~~~~~~~~~~~~~~~~ > linux/tools/perf/trace/beauty/generated/ioctl/vhost_virtio_ioctl_array.c:53:18: > note: (near initialization for ‘vhost_virtio_ioctl_read_cmds[128]’) > > Because there are two entries for 0x80 now. > > Is it ok for vhost to have the same number for VQS_COUNT > and VRING_SIZE? > > Thanks, > Namhyung Oh! This is a bug in: commit 1496c47065f9f8413296780c63374daee9bdae20 Author: Zhu Lingshan Date: Sat Feb 3 00:38:56 2024 +0800 vhost-vdpa: uapi to support reporting per vq size The size of a virtqueue is a per vq configuration. This commit introduce a new ioctl uAPI to support this flexibility. Signed-off-by: Zhu Lingshan Message-Id: <20240202163905.8834-2-lingshan.zhu@intel.com> Signed-off-by: Michael S. Tsirkin It's great that you noticed. It works by chance because one is IOR the other IOWR and the size is different. But yes we must fix it - it is not too late this is just in an rc not in any released kernels. Will send a fix soon! > > > [0x81] = "VDPA_GET_GROUP_NUM", > > [0x8] = "NEW_WORKER", > > }; > > $ > > > > For instance, see how those 'cmd' ioctl arguments get translated, now > > VDPA_GET_VRING_SIZE will be as well. > > > > # perf trace -a -e ioctl --max-events=10 > > 0.000 ( 0.011 ms): pipewire/2261 ioctl(fd: 60, cmd: SNDRV_PCM_HWSYNC, arg: 0x1) = 0 > > 21.353 ( 0.014 ms): pipewire/2261 ioctl(fd: 60, cmd: SNDRV_PCM_HWSYNC, arg: 0x1) = 0 > > 25.766 ( 0.014 ms): gnome-shell/2196 ioctl(fd: 14, cmd: DRM_I915_IRQ_WAIT, arg: 0x7ffe4a22c740) = 0 > > 25.845 ( 0.034 ms): gnome-shel:cs0/2212 ioctl(fd: 14, cmd: DRM_I915_IRQ_EMIT, arg: 0x7fd43915dc70) = 0 > > 25.916 ( 0.011 ms): gnome-shell/2196 ioctl(fd: 9, cmd: DRM_MODE_ADDFB2, arg: 0x7ffe4a22c8a0) = 0 > > 25.941 ( 0.025 ms): gnome-shell/2196 ioctl(fd: 9, cmd: DRM_MODE_ATOMIC, arg: 0x7ffe4a22c840) = 0 > > 32.915 ( 0.009 ms): gnome-shell/2196 ioctl(fd: 9, cmd: DRM_MODE_RMFB, arg: 0x7ffe4a22cf9c) = 0 > > 42.522 ( 0.013 ms): gnome-shell/2196 ioctl(fd: 14, cmd: DRM_I915_IRQ_WAIT, arg: 0x7ffe4a22c740) = 0 > > 42.579 ( 0.031 ms): gnome-shel:cs0/2212 ioctl(fd: 14, cmd: DRM_I915_IRQ_EMIT, arg: 0x7fd43915dc70) = 0 > > 42.644 ( 0.010 ms): gnome-shell/2196 ioctl(fd: 9, cmd: DRM_MODE_ADDFB2, arg: 0x7ffe4a22c8a0) = 0 > > # > > > > Cc: Adrian Hunter > > Cc: Ian Rogers > > Cc: Jiri Olsa > > Cc: Kan Liang > > Cc: Michael S. Tsirkin > > Cc: Namhyung Kim > > Cc: Zhu Lingshan > > Link: https://lore.kernel.org/lkml/ > > Signed-off-by: Arnaldo Carvalho de Melo > > --- > > tools/perf/trace/beauty/include/uapi/linux/vhost.h | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/tools/perf/trace/beauty/include/uapi/linux/vhost.h b/tools/perf/trace/beauty/include/uapi/linux/vhost.h > > index 649560c685f13b73..bea6973906134656 100644 > > --- a/tools/perf/trace/beauty/include/uapi/linux/vhost.h > > +++ b/tools/perf/trace/beauty/include/uapi/linux/vhost.h > > @@ -227,4 +227,11 @@ > > */ > > #define VHOST_VDPA_GET_VRING_DESC_GROUP _IOWR(VHOST_VIRTIO, 0x7F, \ > > struct vhost_vring_state) > > + > > +/* Get the queue size of a specific virtqueue. > > + * userspace set the vring index in vhost_vring_state.index > > + * kernel set the queue size in vhost_vring_state.num > > + */ > > +#define VHOST_VDPA_GET_VRING_SIZE _IOWR(VHOST_VIRTIO, 0x80, \ > > + struct vhost_vring_state) > > #endif > > -- > > 2.44.0 > >