Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2305537rdb; Tue, 3 Oct 2023 17:58:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1GqT2unm4QZxpYZBdYmTeLp6af45gwIlTB9pQYY1mDqrHe3owjVqG7DrdwJjPQjUbWs+s X-Received: by 2002:a05:6a20:7288:b0:15e:f2a1:dae with SMTP id o8-20020a056a20728800b0015ef2a10daemr5884685pzk.27.1696381094430; Tue, 03 Oct 2023 17:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696381094; cv=none; d=google.com; s=arc-20160816; b=qdAF6yeXqnr3zWSB/L6Dxr/+a1aCORy35vFfjpKwOCDyyOpsn1E0QRJHs9kKvTIyPK SfUyKy/fx1fAr9ZR6hPPfEtx4Ri3c6SB3Bbh3dsfHABZkQOcGwCVvXvtL4tTEtgrVgvD pRIgp1jPzyNX27cv4TasTQQc/JmLcMJtMW8GN+OhgZfLQGut5bTq33QtsIodBrqPEWXU tJERI+c5/w6hB/Tpp+fBR34azby8ys6PWLmXZ/EzJ6hjkwA5SPyGe4mgEPNgt2j8Ha7t fLBjV2fwlbddP2OUs5MFzs6zYIwF1CfummuOraHk6LnJzR4WRkw9/UPqegrUNpUyl8yy 5WCA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Ck4nxn4J4zmFxlzkMuhARBh/wvgCxkM1TFcZ+dHzvwM=; fh=uHRJ/FLiqRRjw2m8e3cwfwZqTHUAgRVL+3ewB4Xmo+g=; b=esMIMRWJvuUqvh4qbta5cmSY7gpirQl8KBJBn7DrPwo4XAUn6TaELDf/TWuATCRQFU ySr6/68ElIrjjyg7qoFCWTihiFZ8FFukzYfkLBAJiCaL9EY0jKah4cFVAw5ZdB7IkfWW /BOHogCJnk8lxEICD8H2Q0enCeeRNMTTKbQihUGNNYSgd3+hX5So73SPIHvb5m0E5xqN z2nJTKwIakgZyoS13JiJNrVCkBRZ8x1PL0RPP/FqXsSq/d+LppEAld3HTjKTMoL+bwBA IG+LSO5xM2OsXV4W4I+u7+fJhTXDxz+r4qQxrAqFdQ27S3WM1b8HmWFEJMU3w3ZLqO6b pPzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id e1-20020a636901000000b00584a9290bd5si2474625pgc.442.2023.10.03.17.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 17:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 042E28317E86; Tue, 3 Oct 2023 17:58:13 -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 S237344AbjJDA6K (ORCPT + 99 others); Tue, 3 Oct 2023 20:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238800AbjJDA6H (ORCPT ); Tue, 3 Oct 2023 20:58:07 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA87BBF; Tue, 3 Oct 2023 17:58:03 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E3BBC433C7; Wed, 4 Oct 2023 00:58:02 +0000 (UTC) Date: Tue, 3 Oct 2023 20:59:08 -0400 From: Steven Rostedt To: Beau Belgrave Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, cleger@rivosinc.com, linux-kselftest@vger.kernel.org, Shuah Khan , Shuah Khan Subject: Re: [PATCH 2/2] selftests/user_events: Fix abi_test for BE archs Message-ID: <20231003205908.391d17f5@gandalf.local.home> In-Reply-To: <20230925230829.341-3-beaub@linux.microsoft.com> References: <20230925230829.341-1-beaub@linux.microsoft.com> <20230925230829.341-3-beaub@linux.microsoft.com> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 17:58:13 -0700 (PDT) Note, this doesn't seem to apply to my tree so I only added the first patch. I think this needs to go through Shuah's tree. -- Steve On Mon, 25 Sep 2023 23:08:29 +0000 Beau Belgrave wrote: > The abi_test currently uses a long sized test value for enablement > checks. On LE this works fine, however, on BE this results in inaccurate > assert checks due to a bit being used and assuming it's value is the > same on both LE and BE. > > Use int type for 32-bit values and long type for 64-bit values to ensure > appropriate behavior on both LE and BE. > > Fixes: 60b1af8de8c1 ("tracing/user_events: Add ABI self-test") > Signed-off-by: Beau Belgrave > --- > tools/testing/selftests/user_events/abi_test.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/tools/testing/selftests/user_events/abi_test.c b/tools/testing/selftests/user_events/abi_test.c > index 5125c42efe65..67af4c491c0c 100644 > --- a/tools/testing/selftests/user_events/abi_test.c > +++ b/tools/testing/selftests/user_events/abi_test.c > @@ -46,7 +46,7 @@ static int change_event(bool enable) > return ret; > } > > -static int reg_enable(long *enable, int size, int bit) > +static int reg_enable(void *enable, int size, int bit) > { > struct user_reg reg = {0}; > int fd = open(data_file, O_RDWR); > @@ -68,7 +68,7 @@ static int reg_enable(long *enable, int size, int bit) > return ret; > } > > -static int reg_disable(long *enable, int bit) > +static int reg_disable(void *enable, int bit) > { > struct user_unreg reg = {0}; > int fd = open(data_file, O_RDWR); > @@ -89,12 +89,14 @@ static int reg_disable(long *enable, int bit) > } > > FIXTURE(user) { > - long check; > + int check; > + long check_long; > }; > > FIXTURE_SETUP(user) { > change_event(false); > self->check = 0; > + self->check_long = 0; > } > > FIXTURE_TEARDOWN(user) { > @@ -131,9 +133,9 @@ TEST_F(user, bit_sizes) { > > #if BITS_PER_LONG == 8 > /* Allow 0-64 bits for 64-bit */ > - ASSERT_EQ(0, reg_enable(&self->check, sizeof(long), 63)); > - ASSERT_NE(0, reg_enable(&self->check, sizeof(long), 64)); > - ASSERT_EQ(0, reg_disable(&self->check, 63)); > + ASSERT_EQ(0, reg_enable(&self->check_long, sizeof(long), 63)); > + ASSERT_NE(0, reg_enable(&self->check_long, sizeof(long), 64)); > + ASSERT_EQ(0, reg_disable(&self->check_long, 63)); > #endif > > /* Disallowed sizes (everything beside 4 and 8) */ > @@ -195,7 +197,7 @@ static int clone_check(void *check) > for (i = 0; i < 10; ++i) { > usleep(100000); > > - if (*(long *)check) > + if (*(int *)check) > return 0; > } >