From patchwork Mon Jan 30 12:44:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 50264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2162170wrn; Mon, 30 Jan 2023 04:56:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXur1zAryVKMqyRUYL5nR/8ctqGhmiaerzajoAuPWA7zk/OFUzBkzBkqEVVN4HsdEzzCGhCX X-Received: by 2002:a17:906:3741:b0:861:eb6e:8019 with SMTP id e1-20020a170906374100b00861eb6e8019mr47619849ejc.69.1675083407504; Mon, 30 Jan 2023 04:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675083407; cv=none; d=google.com; s=arc-20160816; b=HOAK29Rn7IfFCfhAB+TLvxugUVjUXhsC5X2QSBgAdxvh2ezaMwdYnW/8vYqNPDf4dm fVmqba92fU4UfB5gK6012mRhR7kSuiPp2fohJVzePrHiVcRFhUDBJ4Rvzi+0J6raKB+6 jUbGlUWMAUH1MHIlHK3D2oxsL/GqQj49tSqQNgdk3F5ex9TTrfG3uifSpzRDLwJ3QDTr Dboo6c0rGIqMEuJEqoodu278uuEXAMXY2VXpRuts1wS3V3VJS5QLkUoODivTBtMEWnZt XFMKTZAkCXxadXUKd+alzTYB22Gq3AsZ8MvSqYlbCj0EXUdKekJoPDEAkxQkFDn6UlKs plQw== 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; bh=dChWNwPCRCnjEJIid9RgFOrDrHScgtgvYi+e6MTCkzg=; b=nREeidBBqlmdrIgEN8SbSLEsJbIk2wEfoj4m5uTGisWqn8GowQzpFLuYf2ilSlYXCS k+9ZGihqM4QCq37i+5EZneTzjqsP0A3tt1AXfytfUoV6xMM9hXkQkrnm9oLOLzlCYnSf GqtIjHHoa2TEhA33sKrzQUA/+l6fgpL3kT5N+PTycccUHqbAGd8+X6NtL1/Imj2fsXXU VPoghnwludDnBBkxCD8b2/J4joNysPVp99BBPD+Hn3pFAUr4pzgNBLtiVrjTbFQb0a+r 26fzwMeh+LFyM+9RhuYdCGvPe9IUrtLoS+id1IlwAWVZpjdJiRphHIjzZ3zLahBWN8AL iUOg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 6-20020a170906024600b00887f7d97f5bsi3248228ejl.29.2023.01.30.04.56.24; Mon, 30 Jan 2023 04:56:47 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236632AbjA3MpG (ORCPT + 99 others); Mon, 30 Jan 2023 07:45:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236682AbjA3Moz (ORCPT ); Mon, 30 Jan 2023 07:44:55 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12E8628D05; Mon, 30 Jan 2023 04:44:53 -0800 (PST) Received: from canpemm500007.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4P57Bs3KfMzJrxn; Mon, 30 Jan 2023 20:43:17 +0800 (CST) Received: from localhost (10.174.179.215) by canpemm500007.china.huawei.com (7.192.104.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 30 Jan 2023 20:44:51 +0800 From: YueHaibing To: , , , , CC: , , , YueHaibing Subject: [PATCH -next] KVM: selftests: Fix build error Date: Mon, 30 Jan 2023 20:44:45 +0800 Message-ID: <20230130124445.3476-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500007.china.huawei.com (7.192.104.62) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756452259436585882?= X-GMAIL-MSGID: =?utf-8?q?1756452259436585882?= kvm selftests build fails with below info: rseq_test.c:48:13: error: conflicting types for ‘sys_getcpu’; have ‘void(unsigned int *)’ 48 | static void sys_getcpu(unsigned *cpu) | ^~~~~~~~~~ In file included from rseq_test.c:23: ../rseq/rseq.c:82:12: note: previous definition of ‘sys_getcpu’ with type ‘int(unsigned int *, unsigned int *)’ 82 | static int sys_getcpu(unsigned *cpu, unsigned *node) | ^~~~~~~~~~ commit 66d42ac73fc6 ("KVM: selftests: Make rseq compatible with glibc-2.35") has include "../rseq/rseq.c", and commit 99babd04b250 ("selftests/rseq: Implement rseq numa node id field selftest") add sys_getcpu() implement, so use sys_getcpu in rseq/rseq.c to fix this. Fixes: 99babd04b250 ("selftests/rseq: Implement rseq numa node id field selftest") Signed-off-by: YueHaibing --- tools/testing/selftests/kvm/rseq_test.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/kvm/rseq_test.c b/tools/testing/selftests/kvm/rseq_test.c index 3045fdf9bdf5..69ff39aa2991 100644 --- a/tools/testing/selftests/kvm/rseq_test.c +++ b/tools/testing/selftests/kvm/rseq_test.c @@ -41,18 +41,6 @@ static void guest_code(void) GUEST_SYNC(0); } -/* - * We have to perform direct system call for getcpu() because it's - * not available until glic 2.29. - */ -static void sys_getcpu(unsigned *cpu) -{ - int r; - - r = syscall(__NR_getcpu, cpu, NULL, NULL); - TEST_ASSERT(!r, "getcpu failed, errno = %d (%s)", errno, strerror(errno)); -} - static int next_cpu(int cpu) { /* @@ -249,7 +237,12 @@ int main(int argc, char *argv[]) * across the seq_cnt reads. */ smp_rmb(); - sys_getcpu(&cpu); + /* + * We have to perform direct system call for getcpu() because it's + * not available until glic 2.29. + */ + r = sys_getcpu(&cpu, NULL); + TEST_ASSERT(!r, "getcpu failed, errno = %d (%s)", errno, strerror(errno)); rseq_cpu = rseq_current_cpu_raw(); smp_rmb(); } while (snapshot != atomic_read(&seq_cnt));