Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp221358rdg; Tue, 10 Oct 2023 08:29:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmL7N2Ldmk7EvcTfLa6Y/ohF5f4oxu6oHzljW6J/d/LLtWl+j29AFCj2u/pLWk3nZqnD2d X-Received: by 2002:a05:6a00:a26:b0:68f:c215:a825 with SMTP id p38-20020a056a000a2600b0068fc215a825mr18015509pfh.12.1696951740268; Tue, 10 Oct 2023 08:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696951740; cv=none; d=google.com; s=arc-20160816; b=oDIltcixmA+l8u9xDDRvyhNvY4wm24bIvzss05wWYdZOKWJkJJFcFQoKhdY/6SnUah jpHSzVommVgMtgGGB/dQiEYG45wgWStq5oeku0RRSEexnL8HwqacZDeuJHzMD5voxQB4 fcZkViBMqIboeBeb6fNAC8aAwenhDxkpIVjkIefQc376PLBUZnfF2siWhYYqhwT5kOnG FFX0OTsWZMIOUCy1ZFSlDL4OAXAsPn77cv+JvB77Yl4XFnNkiHK957tDrUAZ9A4nTxc5 rQtejuGW/n8RbSNflZ+66DIReOWsTRPztXSkr/yDn+U36p7pd83Mp8pnr6XVXJ7Qe/1i djNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ekO9fiWw5dM/5weaz3ceIzr6MnGrpqT9loFE7MOGyrU=; fh=3IHKc1nJpjRhVV0myx4Wzf3sTfGznxIfktyGkLXfSkA=; b=QB/emGsedkK4GC1izH6EST4bbZ3fguRKhOr4OU9hY19wmKnpr25sJChwrs3JVGstMk Aspu9RV3VHnwYkOdlySOyXwRXNksg4fh2Ha86NWgvdi8mmPuP+jd+hcuA9u+seBEVq4n 4Zu1Hid7HPv8MY7i626qDjROzXnXuDpodKUbSw4zk/7RQJ/sB06udlnX8yfXU8RDhGyi /M7M3nP2P8q0DNYGE84J/1V9GRNrEDGTD/njx8T1mn4xuFP+A3aIgsLYdkWGKrcrtP8S jVGKeSTF/FhKb8QOtV+paWDyLBZDQjUQMJ1UsZj8IaPYKiWJ15VV59PyLj7Dgh57UU5G a3oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FMzgRh7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i184-20020a6387c1000000b005855989b5fesi11376572pge.610.2023.10.10.08.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 08:29:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FMzgRh7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6D0C880C7AF5; Tue, 10 Oct 2023 08:28:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232667AbjJJP2r (ORCPT + 99 others); Tue, 10 Oct 2023 11:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjJJP2q (ORCPT ); Tue, 10 Oct 2023 11:28:46 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CD34AF for ; Tue, 10 Oct 2023 08:28:43 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5068b69f4aeso13701e87.0 for ; Tue, 10 Oct 2023 08:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696951721; x=1697556521; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ekO9fiWw5dM/5weaz3ceIzr6MnGrpqT9loFE7MOGyrU=; b=FMzgRh7nFfJZT1vSt5yVw4JXV++TtBXraW2kKnZAKQ7lzX/0RSzo6PjXlAvg/n8n+4 JsS8JEPnJItkFgjPIeodqbf+TOHgo5FLAlp54T1KEpiBcPLfNrF9vYeO+/wJpJbPwZma 2NAgOhxBI09+7bCMnoMytBe0CXmhxYyC/72w4fH4Kqn+xmhfONU4qpIqzo2BulTy4onv Z98rXcpUIwxS2NPj/BQGTZki1iJ8XoUlbXcgtBnHoL5dv9NmzwbodCXBnPEx3xbe/4oL 4qJpLaL9He7OdZQn7RoU3XQBdnmx1wqkMcYIMaE2F0pkG8zUnnWWpc+u7RqXHn0VFMu+ 03HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696951721; x=1697556521; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ekO9fiWw5dM/5weaz3ceIzr6MnGrpqT9loFE7MOGyrU=; b=W0pa1szbhjaA9Uppk+MXYeo2QnQmOEmSBobx/VqBd5u0K6TiYCC7DiH6wjFszJEf6r wwmLGjmMiGSPp3oex91bdHZf7+CBMhq/9R513BOLVNUaUBujp/62nXXucEExAPNi66Wa wGDobzamfqxrqt6NNTvjTCK/AmDFn/LHgrUa2zfkOaLRWsDW8kk3BhUGXQGxTJNeJAdv BxittWPnPDXJIUracLCp0cLsXBrJb75tk56ugXNxuJ9bGKep3YEgdHZBLxLQUz3Hx3XB 02tdPyhfxpTiwu0PpwkGUeR0vEYC/4NhvMft04p6E+X6l+hw6V0L6cf1PwEIEkUDaSoU fQjQ== X-Gm-Message-State: AOJu0Yyf+F1e0iLX3wH6ec1X03MteFFe+XAttFeLCj+EAY8ZXsKnth6t C+kaXCnT4cDWFfvpihl08FS8AW1N86xH5I0lsLqwieqEc+q0DGhnwLvmdA== X-Received: by 2002:ac2:44a1:0:b0:501:3d3:cbc0 with SMTP id c1-20020ac244a1000000b0050103d3cbc0mr329938lfm.2.1696951721128; Tue, 10 Oct 2023 08:28:41 -0700 (PDT) MIME-Version: 1.0 References: <20231005190451.175568-1-adrian.hunter@intel.com> <20231010142234.20061-1-adrian.hunter@intel.com> In-Reply-To: <20231010142234.20061-1-adrian.hunter@intel.com> From: Ian Rogers Date: Tue, 10 Oct 2023 08:28:29 -0700 Message-ID: Subject: Re: [PATCH] perf tools: Add unaligned.h to check-headers.sh To: Adrian Hunter Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 10 Oct 2023 08:28:57 -0700 (PDT) On Tue, Oct 10, 2023 at 7:22=E2=80=AFAM Adrian Hunter wrote: > > Add include/asm-generic/unaligned.h to check-headers.sh bringing > tools/include/asm-generic/unaligned.h up to date so that the kernel and > tools versions match. > > Signed-off-by: Adrian Hunter Reviewed-by: Ian Rogers Thanks, Ian > --- > > > Based on top of 5 patch set "perf intel-pt: Use of get_unaligned_le16() e= tc" > > > tools/include/asm-generic/unaligned.h | 129 ++++++++++++++++++++++++-- > tools/perf/check-headers.sh | 1 + > 2 files changed, 122 insertions(+), 8 deletions(-) > > diff --git a/tools/include/asm-generic/unaligned.h b/tools/include/asm-ge= neric/unaligned.h > index 9140bb4e16c6..156743d399ae 100644 > --- a/tools/include/asm-generic/unaligned.h > +++ b/tools/include/asm-generic/unaligned.h > @@ -1,11 +1,11 @@ > -/* SPDX-License-Identifier: GPL-2.0-or-later */ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef __ASM_GENERIC_UNALIGNED_H > +#define __ASM_GENERIC_UNALIGNED_H > + > /* > - * Copied from the kernel sources to tools/perf/: > + * This is the most generic implementation of unaligned accesses > + * and should work almost anywhere. > */ > - > -#ifndef __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H > -#define __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H > - > #pragma GCC diagnostic push > #pragma GCC diagnostic ignored "-Wpacked" > > @@ -37,7 +37,120 @@ static inline u64 get_unaligned_le64(const void *p) > return le64_to_cpu(__get_unaligned_t(__le64, p)); > } > > -#pragma GCC diagnostic pop > +static inline void put_unaligned_le16(u16 val, void *p) > +{ > + __put_unaligned_t(__le16, cpu_to_le16(val), p); > +} > + > +static inline void put_unaligned_le32(u32 val, void *p) > +{ > + __put_unaligned_t(__le32, cpu_to_le32(val), p); > +} > + > +static inline void put_unaligned_le64(u64 val, void *p) > +{ > + __put_unaligned_t(__le64, cpu_to_le64(val), p); > +} > + > +static inline u16 get_unaligned_be16(const void *p) > +{ > + return be16_to_cpu(__get_unaligned_t(__be16, p)); > +} > + > +static inline u32 get_unaligned_be32(const void *p) > +{ > + return be32_to_cpu(__get_unaligned_t(__be32, p)); > +} > + > +static inline u64 get_unaligned_be64(const void *p) > +{ > + return be64_to_cpu(__get_unaligned_t(__be64, p)); > +} > + > +static inline void put_unaligned_be16(u16 val, void *p) > +{ > + __put_unaligned_t(__be16, cpu_to_be16(val), p); > +} > + > +static inline void put_unaligned_be32(u32 val, void *p) > +{ > + __put_unaligned_t(__be32, cpu_to_be32(val), p); > +} > + > +static inline void put_unaligned_be64(u64 val, void *p) > +{ > + __put_unaligned_t(__be64, cpu_to_be64(val), p); > +} > + > +static inline u32 __get_unaligned_be24(const u8 *p) > +{ > + return p[0] << 16 | p[1] << 8 | p[2]; > +} > > -#endif /* __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H */ > +static inline u32 get_unaligned_be24(const void *p) > +{ > + return __get_unaligned_be24(p); > +} > + > +static inline u32 __get_unaligned_le24(const u8 *p) > +{ > + return p[0] | p[1] << 8 | p[2] << 16; > +} > + > +static inline u32 get_unaligned_le24(const void *p) > +{ > + return __get_unaligned_le24(p); > +} > + > +static inline void __put_unaligned_be24(const u32 val, u8 *p) > +{ > + *p++ =3D val >> 16; > + *p++ =3D val >> 8; > + *p++ =3D val; > +} > + > +static inline void put_unaligned_be24(const u32 val, void *p) > +{ > + __put_unaligned_be24(val, p); > +} > + > +static inline void __put_unaligned_le24(const u32 val, u8 *p) > +{ > + *p++ =3D val; > + *p++ =3D val >> 8; > + *p++ =3D val >> 16; > +} > + > +static inline void put_unaligned_le24(const u32 val, void *p) > +{ > + __put_unaligned_le24(val, p); > +} > + > +static inline void __put_unaligned_be48(const u64 val, u8 *p) > +{ > + *p++ =3D val >> 40; > + *p++ =3D val >> 32; > + *p++ =3D val >> 24; > + *p++ =3D val >> 16; > + *p++ =3D val >> 8; > + *p++ =3D val; > +} > + > +static inline void put_unaligned_be48(const u64 val, void *p) > +{ > + __put_unaligned_be48(val, p); > +} > + > +static inline u64 __get_unaligned_be48(const u8 *p) > +{ > + return (u64)p[0] << 40 | (u64)p[1] << 32 | (u64)p[2] << 24 | > + p[3] << 16 | p[4] << 8 | p[5]; > +} > + > +static inline u64 get_unaligned_be48(const void *p) > +{ > + return __get_unaligned_be48(p); > +} > +#pragma GCC diagnostic pop > > +#endif /* __ASM_GENERIC_UNALIGNED_H */ > diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh > index 4314c9197850..d09c3d46f08f 100755 > --- a/tools/perf/check-headers.sh > +++ b/tools/perf/check-headers.sh > @@ -161,6 +161,7 @@ check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SY= MBOL" -I "^#include check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include= " -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"' > check arch/x86/include/asm/amd-ibs.h '-I "^#include [<\"]\(asm/\)*msr-i= ndex.h"' > check arch/arm64/include/asm/cputype.h '-I "^#include [<\"]\(asm/\)*sysr= eg.h"' > +check include/asm-generic/unaligned.h '-I "^#include " -I "^#include " -I "^#pragma GCC diagnosti= c"' > check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-gene= ric/mman-common\(-tools\)*.h>"' > check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman= .h>"' > check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)*= static_assert$"' > -- > 2.34.1 >