Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2345780lqz; Tue, 2 Apr 2024 14:46:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6cLz5hY3OFjDH8y4/5sI0pDGIe8OBZ40GfDXZO+pWGWgY/OdWProBl/FJBjUUVYPHShcDgMACCmQNkQbFqJd23DlCDzTtyvp8NC5QAQ== X-Google-Smtp-Source: AGHT+IHpRSCZ+nhTzv3JxAFJVKqjAnCizZ4Tlf3/Aqzk2uO/ObX9QvrXoDHXRW7xJuGrRbyTH9q0 X-Received: by 2002:a17:903:1cb:b0:1e0:73d:9175 with SMTP id e11-20020a17090301cb00b001e0073d9175mr17326420plh.45.1712094401212; Tue, 02 Apr 2024 14:46:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712094401; cv=pass; d=google.com; s=arc-20160816; b=exkJt8DpMV9hXnHfoiS59oB4bb+yAUAE8ZnmC9zsrCiWb/WYXyp4k0mz9xFLm6Nju2 eRhw94l/E5OKjP+X7hOhoKwRHATFWONfpU3CnzNm0ctre6hLEK7OFf4MMTcTviUW5S9j LH+wPIWXocjfuOvwk4o+toS9wO0/RElN7+zGdQE0loLi6mIxhuI6bSUd0MnWPo0GBo7z ANjmEql3nzQoBKtYM7K4zrYIc0Pc4ZlshMcJS9Laz1Baxys0kRDDjIZJpwHEkqbJ8waZ ubA200R9wZ8A3gW23sYz5pWkJztqVxQEP6JlVeLb/zrJn/lHkXdXlRIw1hfoVbEoJFuv LiKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=sHMZ5ZfjDlzhuCc8wxpi09Fy7l7fXAvEFvPzhQUXtRs=; fh=qTAzUJpUnei5oldCqUhQvTC/kwzEmPX/QkwQxP5KMRc=; b=NOqHJciyOoKqb1vBsDpiF/eCjdXAFnG5x73HIyPJIGm0dA3ApNLHoEn3hi+S9iY3JW dKxn79hW7FCjawlWx4pJGlHqiX/llWNKG8BX/5JDQg3g2Sd0ma/BJl3sXkSkBnbPWcKq RmuPzVoEu5cGiuiuQ8R+txQ2P34XIR8oJykbsPn5V9Zcob6P+FDEahpg3QWyXvd9if8m SR32KvOdVpJ1lfZZddSeY47Ad/Jl/AP8JMAQPOAzW1+868ZcttUuU0qPwNaxJq72VKYU u/dFulDQ83lv4WL4eJvzXS8KDp7Py7NuMs6EOXPkachL23UuQahifgXPQYQ6lFZcssuP OCTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Qw40s9/b"; 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-128727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128727-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z1-20020a170902ccc100b001e23d7860f2si8943612ple.427.2024.04.02.14.46.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 14:46:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Qw40s9/b"; 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-128727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128727-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 67EDAB291E5 for ; Tue, 2 Apr 2024 21:23:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBC8815E5BF; Tue, 2 Apr 2024 21:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Qw40s9/b" 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 5141B15E1F5 for ; Tue, 2 Apr 2024 21:23:48 +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=1712093030; cv=none; b=remqdvZkfRGoSbb+dyHvav2RMfTPyjsj9FWwnwZ/Thlp5aojl4wXDTpdT7DLk2sGXmjP2aHEHI0ZfIkb2xDOWfktSmhF2o/5C4x19pLAe+fB1D0IlNZ7OpL6Ko+P8JHzSqVx19QqglhIBAWQ3cH6JcWAwymjkX6IecPG3v8QTZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712093030; c=relaxed/simple; bh=3LK6BSSSZXPvfQ5gKh7pcQDJMzVxdZHlpkniJicNZyo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rxLpr0gLYR451zV2IA8/etCLgmeFZCzA3bDxLdv53DNjCET83ZSi+jh/9xCjkkN+yNRJOovIF0ozRy91URYqdOWLd9kQXPvlZsQpgapcbVwJ/3fBw2IIR8LuP/O7KZ79OxAUZe1FssnwGyvg8yc7ShYyVOmujy6VaJioijix4e8= 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=Qw40s9/b; arc=none smtp.client-ip=170.10.133.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=1712093027; 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=sHMZ5ZfjDlzhuCc8wxpi09Fy7l7fXAvEFvPzhQUXtRs=; b=Qw40s9/bQJuBcYOvVKhYeZnfxn8Ax8Lcu8I4an+tQ92w/fYau18Y4V461p+1xfCHxDRg5c 2GFu1hYTKDwvGvB3SE4KhFKIaaK8ydaMPNYmq0W4ZvHnKzDdRCukKi+paHv5s/qAfebcZH FkQ0MqnU94dGvqeJxiaSJwVbTq2TZRQ= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-490-0o7nbL4QPwqyIizc-gfOaQ-1; Tue, 02 Apr 2024 17:23:46 -0400 X-MC-Unique: 0o7nbL4QPwqyIizc-gfOaQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a4751d1e7a2so210107866b.2 for ; Tue, 02 Apr 2024 14:23:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712093025; x=1712697825; h=in-reply-to: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=sHMZ5ZfjDlzhuCc8wxpi09Fy7l7fXAvEFvPzhQUXtRs=; b=WMfq35zB1499gnunucXFOq3bYOnVr2p7EsanH5n7JMT0FUV4WI9Bhg9QPZvuOjR5Xo XoGcOJmFTmj6jyyJ5VQTdF8g29p6f4zacHc0D3+FIiQCsT75osH6uG+Bfn5BjzV7Wlpq C0THnL5z3r36iUwJOpacGa4gAHIOP7kJ0plCk96Ock3nISiiQpVRzAzKooVq7trvFGxk C7BqmNXlQXjWBRGsYn/zgBphkjpTb/sDT9VtA4goumTUpeT3cQmD/MTS5OHjbjtfKHlc DNm4NafTOL+bHWIqD3gfOQ8quW833i0b/ESyic19LkCnItqnwK56Jk45816w8l86uguL NHWQ== X-Gm-Message-State: AOJu0YzGmFzAihwoX7ff9ud/AsHuPjRG/uThW4YlDgzOS1D/Ojm34z8q LtrAKWtaNBZLwoGRs338Ba2FNqfvuNlm3WC6oGmszYxFPzdb1/KUVXCvZMujv5D1id0QXO2f9p9 KsC1+X405I+EdWNqFdGZssOOeAH/UO6OqOIZk7KMybqpTThzzrxjbpytLdCridg== X-Received: by 2002:a17:907:7216:b0:a47:34b2:ca4b with SMTP id dr22-20020a170907721600b00a4734b2ca4bmr12327336ejc.50.1712093024798; Tue, 02 Apr 2024 14:23:44 -0700 (PDT) X-Received: by 2002:a17:907:7216:b0:a47:34b2:ca4b with SMTP id dr22-20020a170907721600b00a4734b2ca4bmr12327323ejc.50.1712093024199; Tue, 02 Apr 2024 14:23:44 -0700 (PDT) Received: from redhat.com ([2.52.21.244]) by smtp.gmail.com with ESMTPSA id pk26-20020a170906d7ba00b00a46aafc6948sm6915889ejb.74.2024.04.02.14.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 14:23:43 -0700 (PDT) Date: Tue, 2 Apr 2024 17:23:39 -0400 From: "Michael S. Tsirkin" To: Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, Adrian Hunter , Ian Rogers , Jiri Olsa , Kan Liang , Namhyung Kim , Zhu Lingshan Subject: Re: [PATCH fyi 1/1] perf trace beauty: Sync linux/vhost.h with the kernel sources Message-ID: <20240402172151-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=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Mar 21, 2024 at 05:41:54PM -0300, Arnaldo Carvalho de Melo wrote: > tldr; Just FYI, I'm carrying this on the perf tools tree. > > 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", > [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 Thanks a lot for taking care of this! So given the header is actually buggy pls hang on to this change until I merge the fix for the header (you were CC'd on the patch). It's great we have this redundancy which allowed us to catch the bug in time, and many thanks to Namhyung Kim for reporting the issue! > --- > 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