Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2920501rdb; Fri, 22 Sep 2023 12:04:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGm+zw0mwQLAbm1VYdEwQtq3zovhVnxrRq7B23EVSsTz9wSFbzL7u3lFHCRLV6ogiNqN3dO X-Received: by 2002:a17:90a:f182:b0:26f:f272:144c with SMTP id bv2-20020a17090af18200b0026ff272144cmr557675pjb.27.1695409452940; Fri, 22 Sep 2023 12:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695409452; cv=none; d=google.com; s=arc-20160816; b=nS2gH57bwEkailFJH0qathEgxh8UTBSH/cc/MV9hps5Vk0RlvtWLbHebn+fuJMzFmd CgqUbX5flzc5uzPyVoISL2ZO36tCBuueEb3zwakceOr/Timxku7P5zWw/ikxRQfiyU0n rCP8Wyrso5ic03d8iZlukdryVxDonDTnxwlMPl0SCzcBWZUlc/XVNpv9aU1t4BWdVgt4 nYrscNVnGSkW11yMfIB2AQRnKRE6YgPbKou5cPm3Et9kI0jPOQOoJFyHDSpa0Px9DBuX ZQzNXIF/lF/DsYD2liERy3G+fMZcmKENSgLvssRtPCJqHCpvO3Y3Fq2SD5gCj/oZglW6 3F4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=wY7skFGSh9IgJDFkQorAIyBJ+qj/XXwmSoR+xsvLutM=; fh=4zSMCzNb7rJrUGZtbNPceVM+tszI9ngqwF5WBZpI8NM=; b=aGPKcg/Q6B+odTH6otJoxYyRMKsd4BqQLqA9MxrgF2cLSDnJ8m0EhmTs9+GbagygRN NMp3IDDnRrBeR4soVAnPSH4zmtyoH3BF+iZwojiTrWzAtDAn5jUrSNRY1zxG1S9bYxDa e2gO4tqk1ZuV9um/ZyKh4i2+Fxil8ldBN62dDUldj8FapyqBtFA8uEwDgazg125x3vN7 uRoX5LgzSJaHZW36j1YDUbVo02Bn1f+bHbtDVZR+sWQx4noD+wOc3fZnkbPac2bVQa+P wp5AquMzQIiPKl1jDTvLhYwTQW/NLZvXD6m0dIa1DHHyqot8znca+Om+UEnoIeG05zn4 nl/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UOaM2Rg6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id mr11-20020a17090b238b00b002694b5c3a6asi4395449pjb.190.2023.09.22.12.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 12:04:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UOaM2Rg6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 871558331E39; Thu, 21 Sep 2023 14:17:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232728AbjIUVRf (ORCPT + 99 others); Thu, 21 Sep 2023 17:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232714AbjIUVRR (ORCPT ); Thu, 21 Sep 2023 17:17:17 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E07DC4A336 for ; Thu, 21 Sep 2023 13:40:42 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-573d44762e4so1034266a12.0 for ; Thu, 21 Sep 2023 13:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695328842; x=1695933642; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=wY7skFGSh9IgJDFkQorAIyBJ+qj/XXwmSoR+xsvLutM=; b=UOaM2Rg6qraCS6wd+URfrumxXwnTkARTm/HgBSdVMTeJz6y1q8JILgq0ly6G6PZDNR iLNELILd1EYsAMN/XbOiTJtI0OeIGmcsUUZHNf92/1hCBLk1hwxZ1+/AEBAJKBoJGoZl wfvohXAhM7hMKimKCXSi4uSk7X5zUe/NcwBl7DLzJ6T6+VOTTysgMZy3urrEdfci8nC6 z10pWlDEmjX6I3QLmcNmogzzunYoZEqrexF8cQ4BpnP4vyJVPzZ/kKrh1WfMlA/g3r2q dQT9Qif5xf6Ep4XNlr0VztqMn6/w6yxrPpxjn4559zievcRmX4mgoncw3WqyxM1RWU/l VG+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695328842; x=1695933642; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wY7skFGSh9IgJDFkQorAIyBJ+qj/XXwmSoR+xsvLutM=; b=pyug8etuG2NxCGoU6mYIfYSdLWLs9Lc/mP4DgPHMwdhO4Qfd3kFJuFTKHfBMoDAT9S jpU85u6LoPGYKOE8J2FdeRgDcuSdWwG0BbfQ2D4dOPg3LOVV19ilP5ibB4oMnRp16Hhs UByiFOz3Z0u7mcHid9N/DtSeUDM4FrTNHGfOec78eEKSBCOyBHXKpnwy2UiKVx7QtFsN dhFvBG8kl9FyiljtrHTmOYvrIqiF9CXuhvxsjWb1EdbeVSFOySu1NLw59iBbhfcZHEMF 2gx6cJMGlp4ruZINlqjlfQSfU0ljm//ueObJqn0kjdbonGzuXPuDPjHMwFncfQC3IU5Z r5iA== X-Gm-Message-State: AOJu0YxlTbTTZ2tii64ltVPqpujJ5qsydXEeqcmF6HC7S1gERm7KKleT xpMJ9C5oSHX7O3A3ee3CuIwR2Q/zxYI= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a63:3307:0:b0:56c:24c2:488d with SMTP id z7-20020a633307000000b0056c24c2488dmr80575pgz.4.1695328842280; Thu, 21 Sep 2023 13:40:42 -0700 (PDT) Date: Thu, 21 Sep 2023 13:40:40 -0700 In-Reply-To: <26822c313754e03b2c393e6fdefe495f117bbfff.1695327124.git.isaku.yamahata@intel.com> Mime-Version: 1.0 References: <26822c313754e03b2c393e6fdefe495f117bbfff.1695327124.git.isaku.yamahata@intel.com> Message-ID: Subject: Re: [RFC PATCH v2 3/6] KVM: selftests: Add tests for punch hole on guest_memfd From: Sean Christopherson To: isaku.yamahata@intel.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Michael Roth , Paolo Bonzini , erdemaktas@google.com, Sagi Shahar , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, linux-coco@lists.linux.dev, Chao Peng , Ackerley Tng , Vishal Annapurve , Yuan Yao , Jarkko Sakkinen , Xu Yilun , Quentin Perret , wei.w.wang@intel.com, Fuad Tabba Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:17:33 -0700 (PDT) On Thu, Sep 21, 2023, isaku.yamahata@intel.com wrote: > From: Isaku Yamahata > > Punch hole implies the region is zeroed out. Add tests if the punched > region has zero. > Oppertunistically Remove unused member, pattern, in guest_run_test(). Heh, I didn't pretty much all the same stuff, except I opted to have SET_ATTRIBUTE instead of FALLOCATE_ONLY, e.g. in case we end up with a test that's wants a thrid flavor (or somehow neither?). > Signed-off-by: Isaku Yamahata > --- > .../kvm/x86_64/private_mem_conversions_test.c | 26 ++++++++++++++----- > 1 file changed, 20 insertions(+), 6 deletions(-) > ... > @@ -156,6 +163,10 @@ static void guest_run_test(uint64_t base_gpa, bool do_fallocate) > > if (size > PAGE_SIZE) { > memset((void *)gpa, p2, PAGE_SIZE); > + > + /* Test if punch hole results in zeroing page. */ > + guest_punch_hole_private(gpa, PAGE_SIZE); > + memcmp_g(gpa, 0, PAGE_SIZE); I added a dedicated sub-test to provide a bit more variety in the tests. I highly doubt my version will ever find a bug that isn't caught by this approach, but if nothing else, it's nice to have a completely separate sub-test.