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 BF5ECECAAD5 for ; Fri, 2 Sep 2022 11:20:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235426AbiIBLUY (ORCPT ); Fri, 2 Sep 2022 07:20:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235042AbiIBLUW (ORCPT ); Fri, 2 Sep 2022 07:20:22 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC3526548 for ; Fri, 2 Sep 2022 04:20:20 -0700 (PDT) Date: Fri, 2 Sep 2022 13:20:16 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1662117618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HNgu9Df3adMDi7xgKeHF7SXAhmudfftHtnrTIV+BzCQ=; b=ryX7YZNHQ6shkCVX/4W1B3xRJy+Nn/KMm3u5h0ldHVr0iShnDmq0hi/q+Qi81pPA5gVT+k DGUGJONUJWt5drUC8wAn39C+RTXvwTvh+pAo2KrGT3ZQp0j32Y8D6lWucpA3zHPjZJ8MHi CERyOznRe/FmFRvXosyJYsgU/NQrpFM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Andrew Jones To: Sean Christopherson Cc: Ricardo Koller , Colton Lewis , David Matlack , kvm@vger.kernel.org, pbonzini@redhat.com, maz@kernel.org, oupton@google.com, alex.bennee@linaro.org Subject: Re: [PATCH v2 1/3] KVM: selftests: Create source of randomness for guest code. Message-ID: <20220902112016.tj2rfcnfse7ly2bj@kamzik> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, Sep 01, 2022 at 06:22:05PM +0000, Sean Christopherson wrote: > On Thu, Sep 01, 2022, Ricardo Koller wrote: > > On Tue, Aug 30, 2022 at 07:01:57PM +0000, Colton Lewis wrote: > > > David Matlack writes: > > > > I think this is broken if !partition_vcpu_memory_access. nr_randoms > > > > (per-vCPU) should be `nr_vcpus * vcpu_memory_bytes >> vm->page_shift`. > > > > > > > > > Agree it will break then and should not. But allocating that many more > > > random numbers may eat too much memory. In a test with 64 vcpus, it would > > > try to allocate 64x64 times as many random numbers. I'll try it but may > > > need something different in that case. > > > > You might want to reconsider the idea of using a random number generator > > inside the guest. IRC the reasons against it were: quality of the random > > numbers, and that some random generators use floating-point numbers. I > > don't think the first one is a big issue. The second one might be an > > issue if we want to generate non-uniform distributions (e.g., poisson); > > but not a problem for now. > > I'm pretty I had coded up a pseudo-RNG framework for selftests at one point, but > I cant find the code in my morass of branches and stashes :-( Here's an option that was once proposed by Alex Bennee for kvm-unit-tests. (Someday we need to revisit that MTTCG series...) https://gitlab.com/rhdrjones/kvm-unit-tests/-/commit/2fc51790577c9f91214f72ef51ee5d0e8bbb1b7e Thanks, drew > > Whatever we do, make sure the randomness and thus any failures are easily > reproducible, i.e. the RNG needs to be seeded pseudo-RNG, not fully random.