From patchwork Thu Apr 27 20:11:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 88375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp514583vqo; Thu, 27 Apr 2023 13:30:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6cbqA5P844EBJO4DINBFObY5wvaLmHr2VY8yEXstU4yO4e0RNQl+OxCbP73CEz/hZXu4EB X-Received: by 2002:a05:6a20:2447:b0:ef:6883:cfc3 with SMTP id t7-20020a056a20244700b000ef6883cfc3mr3685150pzc.58.1682627459265; Thu, 27 Apr 2023 13:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682627459; cv=none; d=google.com; s=arc-20160816; b=GbyCV16c8+k8PWTVRn3wwifculzO9lnCtBA5FWkjNFdYT8KkaWPKKWO1DLaScjC3wE Grk0IQ0/FM0RciFNmEiMd4P9U1U5wRyDhYjGEJB5KsWO1wpf9q0icNYKWLUXvxXgXE+f 4af0g0+BEmqFwqCLFjLhkX+DLtqllUC14dDP434XofkCpon+XIbyGGttudGsmhT/xMIr R65SH4e4hy65T60zhkr5HETOb0pgKml/RkCW29cxzvpUBciiq89ZApxJdp0eShNOproq 31mzl8JonNJFzCgyXlrFbNXXhxMZg5RG1xnk7tj/j0n00pmSaXP66+4Y5ixRTAWCYmOf WbIg== 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:date:subject:cc:to:from :dkim-signature; bh=6LCJpqufoYvIBJBVywTzcH9xoKv2yJbkOGxjs6oW1og=; b=CXUibiibrL66f2/Ak61ckTlH5ac3MoodfFa7CSLMy4eeAAFdY3kH6kWT+/ISB6C5Sy 0osO+hYwGmxY6z0hdIxpqkvdcufCQnSkeLMiPdaHzPp5gakyejptFDYLcnafuHY/j+IP 8u6y85IaAp7Uaqf1fq8q28mmdtpg8oCfR0rpVoDnT8a9+kLPx2LRwDZtIBpvz10LGJJD J4yCeG9H866c+uCe2S90Rztvxpd56BAbcrS9Bh/nkXK2wiRXHTLgqgScfCzc6ohdZRov DkkNEKS7cthP3Ri/tfK+rQVs1TKS9pwfja8WnE4/iscodOYakGRK6a6+PMImdkn/z/a2 ZvFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=frim5pWn; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k191-20020a6384c8000000b00513b4eb72a5si20226418pgd.731.2023.04.27.13.30.41; Thu, 27 Apr 2023 13:30:59 -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=frim5pWn; 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 S244338AbjD0UMH (ORCPT + 99 others); Thu, 27 Apr 2023 16:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344145AbjD0UMF (ORCPT ); Thu, 27 Apr 2023 16:12:05 -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 ESMTPS id 8059230FC for ; Thu, 27 Apr 2023 13:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682626279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6LCJpqufoYvIBJBVywTzcH9xoKv2yJbkOGxjs6oW1og=; b=frim5pWnd+2z8UxBHjrHc38u+ZxufmR0mUDk+VsUtXOuOHOgNolu1twM4FdZIHo5P+I7hQ sWuouwi1tG9Cuoy9eBIqN7C2ho5HeqvatZVUk1Tetpa11v4QiNOsTE686ULrnnZ51hY8OL LBcsI+n7f5xx0CbjI38XFyDbFf5uaNw= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-115-1qOMglX4MwKeXmGUye39QA-1; Thu, 27 Apr 2023 16:11:18 -0400 X-MC-Unique: 1qOMglX4MwKeXmGUye39QA-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-3ecc0c4b867so24848921cf.1 for ; Thu, 27 Apr 2023 13:11:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682626277; x=1685218277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6LCJpqufoYvIBJBVywTzcH9xoKv2yJbkOGxjs6oW1og=; b=UJNWEhgB+ZW+zdaBH9hvn/9eI4vL+TcFfW96HTGyFXGGseTHqCfDJ5ZBuA5WYs3Rnr z8uA+a8qkQZaXAKEvWb4V4nF/VPqwaO5yZN+KFSR5HTVfpTqCm35pyvRUxDLJ/VOL6m/ 9CASZbgEIzTXo5pySyzF6iv6bC5OzsFHmLfzugeHJOwNK/RPXYgcYXwFYqpoAbSXSjbi l3NRETZlrrUQUhEopriTIo8e8FgHQOVqxsL9OmvHkEC5BZbAUHwHoHlSGbVhkQuIpg5t 81uYNcZZWMniEQaNHUAgJRFlNZ0ElVwVbDaKztKCb6vSoSoNrlZIfA5mbaYxG8CAP//z b4pg== X-Gm-Message-State: AC+VfDxzxw+ZfUo97aFUzCiNkpF06KuvAxDhNa38H7ViUeziHPNuXZdx eNW3w8tRan9TouNsUBWhTZxnPDi9QmIkTesq18Dbk1QrR7ZsXy/PaLfMTybFCiNBwmflx3re9cO txcLQc949c7AML47drr+ixKU+JKxz3RYaKDXvue6MObsReAeBlCnvbDd5Z10uwm9ycsqALgR34y u2lyyRvA== X-Received: by 2002:a05:622a:1443:b0:3ef:5587:723b with SMTP id v3-20020a05622a144300b003ef5587723bmr135308qtx.3.1682626277174; Thu, 27 Apr 2023 13:11:17 -0700 (PDT) X-Received: by 2002:a05:622a:1443:b0:3ef:5587:723b with SMTP id v3-20020a05622a144300b003ef5587723bmr135257qtx.3.1682626276859; Thu, 27 Apr 2023 13:11:16 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id d19-20020a05620a241300b0074fb065bde4sm3444283qkn.18.2023.04.27.13.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 13:11:16 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson , Paolo Bonzini , James Houghton , peterx@redhat.com, Anish Moorthy Subject: [PATCH 1/2] selftests/kvm: Setup vcpu_alias only for minor mode test Date: Thu, 27 Apr 2023 16:11:11 -0400 Message-Id: <20230427201112.2164776-2-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230427201112.2164776-1-peterx@redhat.com> References: <20230427201112.2164776-1-peterx@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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?1764362770925081432?= X-GMAIL-MSGID: =?utf-8?q?1764362770925081432?= This fixes two things: - Unbreaks MISSING mode test on anonymous memory type - Prefault alias mem before uffd thread creations, otherwise the uffd thread timing will be inaccurate when guest mem size is large, because it'll take prefault time into total time. Signed-off-by: Peter Xu Reviewed-by: James Houghton --- .../testing/selftests/kvm/demand_paging_test.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c index 2439c4043fed..9c18686b4f63 100644 --- a/tools/testing/selftests/kvm/demand_paging_test.c +++ b/tools/testing/selftests/kvm/demand_paging_test.c @@ -128,6 +128,7 @@ static void prefault_mem(void *alias, uint64_t len) static void run_test(enum vm_guest_mode mode, void *arg) { + struct memstress_vcpu_args *vcpu_args; struct test_params *p = arg; struct uffd_desc **uffd_descs = NULL; struct timespec start; @@ -145,24 +146,24 @@ static void run_test(enum vm_guest_mode mode, void *arg) "Failed to allocate buffer for guest data pattern"); memset(guest_data_prototype, 0xAB, demand_paging_size); + if (p->uffd_mode == UFFDIO_REGISTER_MODE_MINOR) { + for (i = 0; i < nr_vcpus; i++) { + vcpu_args = &memstress_args.vcpu_args[i]; + prefault_mem(addr_gpa2alias(vm, vcpu_args->gpa), + vcpu_args->pages * memstress_args.guest_page_size); + } + } + if (p->uffd_mode) { uffd_descs = malloc(nr_vcpus * sizeof(struct uffd_desc *)); TEST_ASSERT(uffd_descs, "Memory allocation failed"); - for (i = 0; i < nr_vcpus; i++) { - struct memstress_vcpu_args *vcpu_args; void *vcpu_hva; - void *vcpu_alias; vcpu_args = &memstress_args.vcpu_args[i]; /* Cache the host addresses of the region */ vcpu_hva = addr_gpa2hva(vm, vcpu_args->gpa); - vcpu_alias = addr_gpa2alias(vm, vcpu_args->gpa); - - prefault_mem(vcpu_alias, - vcpu_args->pages * memstress_args.guest_page_size); - /* * Set up user fault fd to handle demand paging * requests. From patchwork Thu Apr 27 20:11:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 88377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp517934vqo; Thu, 27 Apr 2023 13:38:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/30dH3FTpViLFQt+29YNOpjhJRblFT9gxV56U47b0qpElsoeZv1mR7tomuDlwffc97Rsa X-Received: by 2002:a05:6a00:2e03:b0:63a:65a9:10db with SMTP id fc3-20020a056a002e0300b0063a65a910dbmr4042773pfb.7.1682627881612; Thu, 27 Apr 2023 13:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682627881; cv=none; d=google.com; s=arc-20160816; b=B0zG8hTZ+jLOddNr3E2yX0Tn/iXVKZTiPafME8CwIanqH6klXDuPOWokxjHwSSfu93 6MZPAHMBSlzw+pYVq3OXi8TtcOHOAnFEXqeSWxA1CiFXwwL3XAqiP7yahq3kCeytudzZ IIpbbFzetAdFx2NBVe4ASTM+BAhD4lztFjZDBfu6vefIS/IufQKSodCVAEBFvGtJYdsJ WX1lGwgP1i1KTMmqvHMW9gt1fjyJ/+dzQvr3OuRw0JQC3cvqNl/6tWHaysiN/zzwBZ7B ZxIj77l1cjcFhDsCMJT+966FQiPCoQu4f7p+HFqo18hSQLZemVZg1AIXxg8GAwyXyWLt El+Q== 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:date:subject:cc:to:from :dkim-signature; bh=MVxEyT6YPQv9FpKzpmnFDZ3linRqP6xqGLLw8EoheGs=; b=FmG4bwkq1dK5UNBotPtuOVcp4Byuxiwvh4tBJQmg+Fz4Yls36n18x3zSJ0DPwxq315 netCgksdrF1kfs8urpctaocZ/O+1WheTAPIqkbaeSeH9cC30lwRkcU9guWs4927QSZWK 1dYH2026lNk1DZ1Cx7ToGXRQy23lE5uAdG0Dw0u93Cfl9U2A/ux0HWNYNYDp9tMKhssy 0YvsbBviUZRLpgKazO6wdT4HkZVGEEJbWjLpp8oKMgD2spJ0mi/pTT1jQykBEgxGQxQU iTTeHygiMAofy4jq0Y23nKajPk8eui7ImLmrjNE4C8hRPaqoIUNECo5u7VA5raZwvMV9 14pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PP3Bryak; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q197-20020a632ace000000b0050be02c590asi19324769pgq.666.2023.04.27.13.37.46; Thu, 27 Apr 2023 13:38:01 -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=PP3Bryak; 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 S1344162AbjD0UMJ (ORCPT + 99 others); Thu, 27 Apr 2023 16:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344147AbjD0UMF (ORCPT ); Thu, 27 Apr 2023 16:12:05 -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 ESMTPS id 824EE3595 for ; Thu, 27 Apr 2023 13:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682626283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MVxEyT6YPQv9FpKzpmnFDZ3linRqP6xqGLLw8EoheGs=; b=PP3BryakO+8e6kGCNBYiDrMUGx/XNJxc8+jDN9etosF+e71GjJr5k/ydHDs5crRFDQMjcd G0Ugc9jm38muhE80RNZ1gonVfZ/vTOf+Wolj2YtY2Vud1ri7cPxNC1ZV84modmSSRZtBEv 0pX1AlzAHUILuoUR809lXGKshomPL20= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-355-zzXpo4SiM4GQ0zEU17PLqA-1; Thu, 27 Apr 2023 16:11:20 -0400 X-MC-Unique: zzXpo4SiM4GQ0zEU17PLqA-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-5ef5fbe2cfaso8207696d6.0 for ; Thu, 27 Apr 2023 13:11:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682626279; x=1685218279; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MVxEyT6YPQv9FpKzpmnFDZ3linRqP6xqGLLw8EoheGs=; b=T8/0QTFugkeLvJLq00D1KMRkto+WybbngQ4yUIa1kaYQ6zLn98l/LAcR/fSVz7YZXR Kikrj73pV4qPECTF/xdYrOApEesVl7uctzfltNq3MwJyeUcQUjZpnePeZYNmR6l4UV3s jl1TUVYewt1K+wQ9KlaPAwWTjLWXDQ1NOhVV5j4xbI2FCOJva4B7iGq+fbVojdOxaJwB pMiFoPYBbgNlhc0z74t0Vvjl8L/PSwqoUB4Vzat2SjkIC1iEDFrux4Ce7cf8/6FLbhp3 u8PmbsnU+N4B36WO+/LxMwc8wNpGxGFGKHT9s3+yzcY4QpJvBnRCXR8P+ornZKBwEd8R QKVA== X-Gm-Message-State: AC+VfDx96ANDALITaTiRz7VNDIW7Ak9ncY35J3x2VunhdDPX/bhwBUHs ld6sCHAbakA4tvyMiCOpKSV0381MWOLcdKP8Q1y2J4UsmLb30hUNM/vz84Za8E7e8KXRr2aHZhf 1vukQxrrFzzjid+1FQXBGWmvaBTF4k28msUePs49f+ugSBmELeYZNY3Z4atOSjQnFmg+dU8s72e ipNmpQ/Q== X-Received: by 2002:a05:622a:1a96:b0:3e6:8da4:427 with SMTP id s22-20020a05622a1a9600b003e68da40427mr4968048qtc.6.1682626279484; Thu, 27 Apr 2023 13:11:19 -0700 (PDT) X-Received: by 2002:a05:622a:1a96:b0:3e6:8da4:427 with SMTP id s22-20020a05622a1a9600b003e68da40427mr4968005qtc.6.1682626279102; Thu, 27 Apr 2023 13:11:19 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id d19-20020a05620a241300b0074fb065bde4sm3444283qkn.18.2023.04.27.13.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 13:11:18 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson , Paolo Bonzini , James Houghton , peterx@redhat.com, Anish Moorthy Subject: [PATCH 2/2] selftests/kvm: Allow dump per-vcpu info for uffd threads Date: Thu, 27 Apr 2023 16:11:12 -0400 Message-Id: <20230427201112.2164776-3-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230427201112.2164776-1-peterx@redhat.com> References: <20230427201112.2164776-1-peterx@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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?1764363213753604295?= X-GMAIL-MSGID: =?utf-8?q?1764363213753604295?= There's one PER_VCPU_DEBUG in per-vcpu uffd threads but it's never hit. Trigger that when quit in normal ways (kick pollfd[1]), meanwhile fix the number of nanosec calculation. Signed-off-by: Peter Xu Reviewed-by: James Houghton --- tools/testing/selftests/kvm/lib/userfaultfd_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/userfaultfd_util.c b/tools/testing/selftests/kvm/lib/userfaultfd_util.c index 92cef20902f1..271f63891581 100644 --- a/tools/testing/selftests/kvm/lib/userfaultfd_util.c +++ b/tools/testing/selftests/kvm/lib/userfaultfd_util.c @@ -70,7 +70,7 @@ static void *uffd_handler_thread_fn(void *arg) r = read(pollfd[1].fd, &tmp_chr, 1); TEST_ASSERT(r == 1, "Error reading pipefd in UFFD thread\n"); - return NULL; + break; } if (!(pollfd[0].revents & POLLIN)) @@ -103,7 +103,7 @@ static void *uffd_handler_thread_fn(void *arg) ts_diff = timespec_elapsed(start); PER_VCPU_DEBUG("userfaulted %ld pages over %ld.%.9lds. (%f/sec)\n", pages, ts_diff.tv_sec, ts_diff.tv_nsec, - pages / ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0)); + pages / ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC)); return NULL; }