Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp464926rwl; Wed, 5 Apr 2023 03:25:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ajOkpywxcSwXplyJsXScDIcIataSfGBeWZcKRdKwDLkFiJSG66jmzcq9L2+pZKNnaN2ebn X-Received: by 2002:a62:5210:0:b0:622:c72a:d0e0 with SMTP id g16-20020a625210000000b00622c72ad0e0mr4674753pfb.13.1680690354321; Wed, 05 Apr 2023 03:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680690354; cv=none; d=google.com; s=arc-20160816; b=0DBFAXugS/X+FkXDcdhXDQc6OVD5ItfoZLHFLkSGJQw+crNWUTT0Y9Bx/UyG5tfb59 u5zrXFh29c56vlWDP0hZ8vvfaBvwoWMiwVUtYmI/OvEOZjdCHfuRoqZDNfipSuOksWXO Og7Cy9OK0k+YkudMdUzwmvfGopVB8lzuBVlXsoO9RDC7e6a6wnSOH7iNcKdcYGecljqg LQV9dVyByxhVFX8MYd6RKFTO9s69xKS6AHiin2ol21ePYGAbzG9Y5zRjP393r2A7CBzw lKu7ZvDEtpPugpX6+CtXBnrS17ArWQH73QDGD5A6pnubjZhyVzs9z+eXGT4bGZwTqkWX ruaA== 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=InCvhDvL4o+hwqQTydORCIegcdBDBTFcwlDcWKuX5OQ=; b=rYQT9qPsUXOXshh2obQ1Hm4eA1nX8rg8zCODOdu802caSGS2QuDuOi6qTcXlOAoxSU C1UwyTzlV0VAbfLKNkgpshfT0M3rdiI4DHTmQ/tXo06I1ucZTjrVIE0fDNtaLGG7QYUx wpB1u5bIjQb3XJfDTUJ5oyKa/cqcgE5YDD24+/brSEliYi4AUlE+3nRCAb5aHnOmFq12 RKCo4zRPi7nVtTTeWT7jyIFcFz86c6yNdvTYODSrvUb6nytTZczc/3MAXKuMBB1HzNyP DOM5YV+/SWe0CwVDekvu/aZ7LGPyNKj0A1fj+yzoovSXkWtWyLQXLytVaY80Tu74kvL/ kz6w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020a63d209000000b0051389efe297si12028128pgg.265.2023.04.05.03.25.42; Wed, 05 Apr 2023 03:25:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237711AbjDEKOc (ORCPT + 99 others); Wed, 5 Apr 2023 06:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231226AbjDEKOa (ORCPT ); Wed, 5 Apr 2023 06:14:30 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3AEF1989; Wed, 5 Apr 2023 03:14:28 -0700 (PDT) X-UUID: d602bed24f3d429bb527d0b6799d2ddb-20230405 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:8917a6d3-17f0-4697-ad62-c68c70d80830,IP:-32 768,URL:-32768,TC:-32768,Content:-32768,EDM:-32768,RT:-32768,SF:-32768,FIL E:-32768,BULK:-32768,RULE:Release_Ham,ACTION:release,TS:0 X-CID-INFO: VERSION:1.1.22,REQID:8917a6d3-17f0-4697-ad62-c68c70d80830,IP:-3276 8,URL:-32768,TC:-32768,Content:-32768,EDM:-32768,RT:-32768,SF:-32768,FILE: -32768,BULK:-32768,RULE:Release_Ham,ACTION:release,TS:0 X-CID-META: VersionHash:120426c,CLOUDID:nil,BulkID:nil,BulkQuantity:0,Recheck: 0,SF:nil,TC:nil,Content:nil,EDM:nil,IP:nil,URL:nil,File:nil,Bulk:nil,QS:ni l,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: d602bed24f3d429bb527d0b6799d2ddb-20230405 X-User: gehao@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 2089193996; Wed, 05 Apr 2023 18:13:54 +0800 From: Hao Ge To: pbonzini@redhat.com, shuah@kernel.org, seanjc@google.com, dmatlack@google.com, coltonlewis@google.com, vipinsh@google.com Cc: gehao@kylinos.cn, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, gehao618@163.com Subject: [RESEND PATCH] kvm/selftests: Close opened file descriptor in stable_tsc_check_supported() Date: Wed, 5 Apr 2023 18:13:50 +0800 Message-Id: <20230405101350.259000-1-gehao@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY 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 Close the "current_clocksource" file descriptor before returning or exiting from stable_tsc_check_supported() in vmx_nested_tsc_scaling_test Signed-off-by: Hao Ge --- .../selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c b/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c index d427eb146bc5..fa03c8d1ce4e 100644 --- a/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c +++ b/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c @@ -126,12 +126,16 @@ static void stable_tsc_check_supported(void) goto skip_test; if (fgets(buf, sizeof(buf), fp) == NULL) - goto skip_test; + goto close_fp; if (strncmp(buf, "tsc", sizeof(buf))) - goto skip_test; + goto close_fp; + fclose(fp); return; + +close_fp: + fclose(fp); skip_test: print_skip("Kernel does not use TSC clocksource - assuming that host TSC is not stable"); exit(KSFT_SKIP); -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus