From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B4ADE7D0AB for ; Thu, 21 Sep 2023 21:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232696AbjIUVRg (ORCPT ); Thu, 21 Sep 2023 17:17:36 -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-Google-Smtp-Source: AGHT+IE2K20JyCSxvBs9FX0l9CJg9tnhr+0tXhOs9dF7vlRV4Ygmc3v4TCO+SwF3JM+aWjkkBb9ehZqxmwE= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.