Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3764912rwe; Mon, 29 Aug 2022 20:13:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR7/BSmWVIpFlw2eE+fUaPkBWbbHtZBOdekvJJxYSTdV2sQ9JOfuICWI8epBQFkp4fRg/whs X-Received: by 2002:a17:90b:1e45:b0:1fa:f63a:87fc with SMTP id pi5-20020a17090b1e4500b001faf63a87fcmr21927391pjb.208.1661829227311; Mon, 29 Aug 2022 20:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661829227; cv=none; d=google.com; s=arc-20160816; b=MlPJ+LhUGee2QslHOTezscbU7MCFnOX/RQ+9tNsmb6tIVohkFs6rpsMFIwRSGjPLOw tY+4ssAj3ygH8Or4CFJ3xjYZKFvRzKhszLTpD0EhblsZIbp3jqRkeO1FwEyxrJYyrKi1 AgDTBkZTQX0LR/ULZWd0zcN5ZHVGG2mENOoM8vg81tUBq+lGmZJfF3sTrxh2r1FiNFfK 1M+iqtyeyZ7ctZ/eL08P+Yp+Zt/YfX4TUtZ+d9umHxwEKiwV2DgErj8HcoC7Qw5Pv6kP QnNPiIym2wE4cZ7tnS9euOE2q2w994f0nVALgVEjsin47DihL6HBofiek3LHzGYKRExj xK4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pW82/yj7UaM08OAYmT1A22ruOWBeVk+vfxWoBPCKIn8=; b=lSV1osmqaLe3keaRzEnY2K9Xvniu+d9/Lt+QzLDNqooyw0m4JIfy0oHwCfzKx9wJ2A 1kz7Pm4BAbjvBINZ+W9qyGDyttuVBfVD+JxmbYV8W66UUx9KEXDHSaz4G/0+NblKeGgz lot3X/pEsGjwzIYq3gYXSGeEviHG3PY56DM5Ke80pbGEEobOtoGXF4brl2LG7KyoauLH 5Dp+bOKjr7blSbRqNQ92JPrSH26HZDiXH8pmc4V7FxA88iHj5bbjhth74L0HCzcHp/d0 NKm9+74WA7iI5DMvev+hdWAY2ZX6l8Tt838G+cXr0dEReGryZ9GCMy04N1e5p9fNgMiZ jjGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YAE7fawY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a63d954000000b0041c11497138si940491pgj.788.2022.08.29.20.13.36; Mon, 29 Aug 2022 20:13:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YAE7fawY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbiH3C2P (ORCPT + 99 others); Mon, 29 Aug 2022 22:28:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbiH3C2M (ORCPT ); Mon, 29 Aug 2022 22:28:12 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACEDE9E2D8 for ; Mon, 29 Aug 2022 19:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661826491; x=1693362491; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=PV46ZO0VLjczO45e44SLoi5r5B6ppa9WttRCbnrioCU=; b=YAE7fawYyNXtL0jfnlGjz4p1hG9p1+mdID8IDx0CJn38sTRX8DsSrH8y JJ5YhJ8Sn1JMgPZEf8tHq6OlHkLcvQKFejI9W6IZyHlF5I1bc2cDUkgfl 5ubTSBp5Fc5soPGZ77MCigiHS5j2vJsQ6RP0XQuIusqU0l8w/HXtmkbiR DIaLxqVogSYJHq64TUTSsnBZtopwMrjPEzdSB9GRHea4uVKBsWdWBnon2 BwWRo7DHbk6nd5QdN+r1XkAW2/ov2ncjHPkhdvgsdIwEQCXJ2+qysZzvm +ZfYX5Y5GrjGwINLypEJ1lCQB/QxrSkfzrH9Rdc1C29XDqAblsNFWoVZ5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="278076151" X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="278076151" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 19:28:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="679857634" Received: from sunyi-station.sh.intel.com (HELO sunyi-station..) ([10.239.159.10]) by fmsmga004.fm.intel.com with ESMTP; 29 Aug 2022 19:28:09 -0700 From: Yi Sun To: dave.hansen@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org Cc: sohil.mehta@intel.com, ak@linux.intel.com, ilpo.jarvinen@linux.intel.com, heng.su@intel.com, yi.sun@intel.com Subject: [PATCH v4 0/2] x86: Add xsave/xrstor Latency Trace Events and Consuming Script Date: Tue, 30 Aug 2022 10:28:06 +0800 Message-Id: <20220830022808.1336447-1-yi.sun@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series introduces trace events which can dump the latency of instructions xsave and xrstor for x86 platform to tell when XSAVE/XRSTOR are getting more or less expensive, and get out the RFBM and XINUSE to figure out the reason. We did bunch of internal testing, compared several optional latency calculation approaches. We believe it can be a more optimized one. Also, the series introduces a script to consume trace log, which leverage sqlite3 to show statistics data such as max, min, latency and 97% tail latency. This series has gone through several versions of peer-reviewed internally. All patches have review tags. It's ready for review by the x86@kernel.org maintainers. - Change from v3 to v4: - Rebase patch set to the latest tag v6.0-rc3, replacing ALTERNATIVE_2 with ALTERNATIVE_3 - Change from v2 to v3: - Move the script xsave-latency-trace.sh to folder tools/testing/fpu/ (Ingo Molnar) - Change from v1 to v2: - Reword the comments. (Laight, David; Mehta, Sohil) - Rename all variable 'dtsc' to 'latency'. (Mehta, Sohil) Yi Sun (2): x86/fpu: Measure the Latency of XSAVE and XRSTOR tools/testing/fpu: Add script to consume trace log of xsave latency arch/x86/include/asm/trace/fpu.h | 35 ++++ arch/x86/kernel/fpu/xstate.h | 49 ++++- tools/testing/fpu/xsave-latency-trace.sh | 227 +++++++++++++++++++++++ 3 files changed, 306 insertions(+), 5 deletions(-) create mode 100755 tools/testing/fpu/xsave-latency-trace.sh -- 2.34.1