Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6927197rwb; Wed, 10 Aug 2022 03:46:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR7CPtDnnX8NUkILeHGKkRQGWXlBElYSEKvvOZhfSoPM3k4hEAGbxoeYxOh1zn1Zz+RPiQY2 X-Received: by 2002:a05:6402:1f06:b0:43c:23c5:d879 with SMTP id b6-20020a0564021f0600b0043c23c5d879mr26055946edb.24.1660128365218; Wed, 10 Aug 2022 03:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660128365; cv=none; d=google.com; s=arc-20160816; b=Ebkb5V4x0VfuVuI+mQl4UY1VstmZ6VkykwzfiSxQZEBrzwLRE4W7uwxxgcpHq+TFA4 WCJZZHMo5XDXVaDBOpLsm+9kF8/cmTwUxh0KgHUgtBqJjQAUSKlp5EAbf3QnxBLqLWkZ 5vcppAwh2qKflA3QsDyPPS3MRSP9sz49vFYtKuXA3VPR56JnNOPQd+cwI1k6IBlhMX0K PNdfs+F3tEfBtkzdkes6BZGRPSLyoFtVi6V1v+OOSZrNDOSQNp+fA48JRQnGvkCfFqUe EcgdN+abEXHXoPZCVpVoBI2VSgSCsBtJHlwp3o9BDuruNlk7/oLcNNlpROh7ZxqVlrS6 YGrw== 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=9bKhNJI7G6HPFM7ZC8g4f1RPMl031HWjaKYN/Cgan+A=; b=E74M/7YjC/Ca+IwzqsdgXKl+i0qjx0CJEB0nUj6LPM8kZ1l951dUnIxASoDkXjuAl1 z+xtlF+Sh/v/ziiFj4Y93VF3vvu0bMoPvDsp0AppzMhFAhLpGDIv1kYgDDIkg/izVMTl /iDJxj/v0hClxpH+rJmOvkXYaGtECEaOcPzcoF2c0h6MkZgyQSwABXT84i8tPepuy7JN 0fADyML1XxFawD3VnwzCZ9I/n/+t2yRWz74pasRg0gFRpNt4TyNyzcCyQ9mPjjfuWR1/ 8Mu4JO3lLKnNiG1jIiPWxvH6n47PY73C+MvCRxzrlJ6wfAHVkxDiX1SniC9Q7HscACce cs+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aPCYH67J; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a05640240c300b0043dc00e0740si11520705edb.373.2022.08.10.03.45.39; Wed, 10 Aug 2022 03:46:05 -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=@redhat.com header.s=mimecast20190719 header.b=aPCYH67J; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230516AbiHJKmE (ORCPT + 99 others); Wed, 10 Aug 2022 06:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231339AbiHJKmD (ORCPT ); Wed, 10 Aug 2022 06:42:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7AF7C6C752 for ; Wed, 10 Aug 2022 03:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660128121; 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; bh=9bKhNJI7G6HPFM7ZC8g4f1RPMl031HWjaKYN/Cgan+A=; b=aPCYH67JsBdv9GfUcuvyKc9JLniBAowtMQqE119GQlGvJO/QpQDYRNSSXmf3/Tj7U3ofY+ HAPiYY/CIRPuv+kmNxS618yXATk8vkX+FPRfwJxNhPEA7osOD8sTMZxFfJ8rBfme112x+H 5ixUqPMfKfD7ASQMzXeJ60VyVStf7so= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-187-vNqntwxVNh6f0s2lJnO8VQ-1; Wed, 10 Aug 2022 06:41:58 -0400 X-MC-Unique: vNqntwxVNh6f0s2lJnO8VQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 91AFC2999B2D; Wed, 10 Aug 2022 10:41:57 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-77.bne.redhat.com [10.64.54.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F1D304050067; Wed, 10 Aug 2022 10:41:52 +0000 (UTC) From: Gavin Shan To: kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, fweimer@redhat.com, shan.gavin@gmail.com, maz@kernel.org, andrew.jones@linux.dev, mathieu.desnoyers@efficios.com, pbonzini@redhat.com, yihyu@redhat.com, seanjc@google.com, oliver.upton@linux.dev Subject: [PATCH v2 0/2] kvm/selftests: Two rseq_test fixes Date: Wed, 10 Aug 2022 18:41:12 +0800 Message-Id: <20220810104114.6838-1-gshan@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 There are two issues in current rseq_test implementation and the series intends to fix them: - From glibc-2.35, rseq information is registered by TLS. It means rseq_test is unable to register its own rseq information. PATCH[01] fixes the issue by reusing "../rseq/rseq.c" to fetch TLS's rseq information if possible. - sched_getcpu() relies on glibc's implementation and it can simply returns the CPU ID cached in the rseq information. In this case, it's pointless to compare the return value from sched_getcpu() and that fetched from rseq information. PATCH[02] fixes the issue by replacing sched_getcpu() with getcpu(). v1: https://lore.kernel.org/lkml/8c1f33b4-a5a1-fcfa-4521-36253ffa22c8@redhat.com/T/ Changelog ========= v2: * Add "-ldl" to LDLIBS as Florian suggested. * Reuse "../rseq/rseq.c" as Paolo/Mathieu/Sean suggested. * Add comments to sys_getcpu() as Sean suggested. Gavin Shan (2): KVM: selftests: Make rseq compatible with glibc-2.35 KVM: selftests: Use getcpu() instead of sched_getcpu() in rseq_test tools/testing/selftests/kvm/Makefile | 5 ++- tools/testing/selftests/kvm/rseq_test.c | 60 ++++++++++++------------- 2 files changed, 33 insertions(+), 32 deletions(-) -- 2.23.0