From patchwork Wed Feb 21 03:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1901824 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=SbURLlPA; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Uy3lBZpT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tfhb02RH6z20Qg for ; Wed, 21 Feb 2024 14:29:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4mvqqb9VrZbB7w4921IcZbgwr5+MPjrd3GAjfeOFtC8=; b=SbURLlPAMVe5aj 09n6uFYbgSUHxi6DXkWPjH7MXiuR8pWQ7InM2kIeTqXWIwv9RIkON44wZs+QVdliUy+xYdng9EEyM snreY8zONYdBHy5rRY7TcTcObcYFbvDljdssesIpaDXWKwDSZLgtLIoosv5NzeMMoJQk4Jt2+Sq33 7zQZBjL2h9AT4VL3y+OAvJ8z4/vNQ6VNL3XvciyDANHSY7mT/m8feMI1l0O1/mU/vZgj8c+9JoL8t Nx7n+ACGVX2Knfv/laKqBuCcP/z4+qYbNKyis/6ssSxiveCGjiKM8i/pI9V64Rkyo6GM052ys2NBG Q5aLWIBCuj55mlpfR0Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcdII-0000000Gz0C-46UU; Wed, 21 Feb 2024 03:29:14 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcdIG-0000000Gyz9-23hJ for kvm-riscv@lists.infradead.org; Wed, 21 Feb 2024 03:29:13 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e0a37751cbso163775b3a.2 for ; Tue, 20 Feb 2024 19:29:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708486150; x=1709090950; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nuBjCwoeaNr8AGy/7SQu2RQwLY1MBjVxyn5YkQsjDDI=; b=Uy3lBZpTFOZjlCNLpuWK1dWojkieXgYOXRx8FLTv4spKfRRRvSbS+68UDTeyYCOzhb K+OKKxRIBO25kjxZMTPA3yCzHzrDpqc2+NuZMPZpIBinT4sk2cibUHwcsyH4vH02L27D CRmpYFyk6Krm62JOPPZ72up7bwDhydzpEZVfHt6yWV/xBrs5oykGOwA7q58mupiNU9Mf kwcRfN7RVcvYu78bdLTnNYpdNFnTm0DgNebKny98YWxK4Zygj1RYQKRT9fkk7teCeFJ5 lBjBwDm5MVk1Pl6q0IfT6HOdvm7fcZA0yCRP8SFedchlXUjELr1dcM5f3G5vPkUbD6dM 5B3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708486150; x=1709090950; 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=nuBjCwoeaNr8AGy/7SQu2RQwLY1MBjVxyn5YkQsjDDI=; b=Oz2F5pBJWfyhbynm01JFlHZR0ZMNe4Mggc+PqV5RSwpTr+M8GP3au2fSXTtXcvd1NK osSi5GAUoFe9XNhV6GARntySnrWdrSQUNFgQ+KghlDx6kCT46QjyTpsX7VyTclNBZ2+H eCe/SLMxG0wEUAXTDwQiImCJm6B0/MewlTmAxEQ9hL5H2z0qp1C2iRjg7JlHSxppu9il eXtJEUTXiHBDSTd0bPJDjJfzjeCalIFYlMJ/gNIU1wPdWXcxiXCsNjmwRVsHMwjOBc+0 eeR19xLkXa8OTu4J+H0Gw253kQX/V158cCuR8cqicy/hbO9wxcZzea4q/dRDk3oALRSt 471g== X-Forwarded-Encrypted: i=1; AJvYcCVZU22H/Yjh+8CNYQ26iDuV4V7nr1rWKBTq8nxacaHPB8+e1c6E7a3dDOq91OfIM1gekabaV2bCZt2tfXWoLMb3P2uo9RWbKJBk+CIAlA== X-Gm-Message-State: AOJu0Yyn6LqZsvqcvDSR+Vv6rV0x6cyv9C51CnxLmR8UAIa95RcNHlJn 0CkhMXqMeqr3SPvcjfkYDve/i+Yl5YIn6lohk7XP/YbXYJ8kBuwj X-Google-Smtp-Source: AGHT+IFMU4gzIndebrpd/hVeeR/Ex4Y3al2xaliSFhhET1KuVUMyOzj4zCCOyaTOOsv8L4D8Foc82g== X-Received: by 2002:a05:6a20:d703:b0:19c:6fb0:2b02 with SMTP id iz3-20020a056a20d70300b0019c6fb02b02mr17269437pzb.61.1708486150696; Tue, 20 Feb 2024 19:29:10 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id q7-20020a170902b10700b001dc214f7353sm1246457plr.249.2024.02.20.19.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 19:29:10 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org Subject: [kvm-unit-tests PATCH v5 7/8] Add common/ directory for architecture-independent tests Date: Wed, 21 Feb 2024 13:27:56 +1000 Message-ID: <20240221032757.454524-8-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240221032757.454524-1-npiggin@gmail.com> References: <20240221032757.454524-1-npiggin@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_192912_552544_519FDC81 X-CRM114-Status: GOOD ( 14.91 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: x86/sieve.c is used by s390x, arm, and riscv via symbolic link. Make a new directory common/ for architecture-independent tests and move sieve.c here. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- arm/sieve.c | 2 +- common/sieve.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ riscv/sieve.c | 2 +- s390x/sieve.c | 2 +- x86/s [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:42d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [npiggin(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org x86/sieve.c is used by s390x, arm, and riscv via symbolic link. Make a new directory common/ for architecture-independent tests and move sieve.c here. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin Acked-by: Andrew Jones --- arm/sieve.c | 2 +- common/sieve.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ riscv/sieve.c | 2 +- s390x/sieve.c | 2 +- x86/sieve.c | 52 +------------------------------------------------- 5 files changed, 55 insertions(+), 54 deletions(-) create mode 100644 common/sieve.c mode change 100644 => 120000 x86/sieve.c diff --git a/arm/sieve.c b/arm/sieve.c index 8f14a5c3d..fe299f309 120000 --- a/arm/sieve.c +++ b/arm/sieve.c @@ -1 +1 @@ -../x86/sieve.c \ No newline at end of file +../common/sieve.c \ No newline at end of file diff --git a/common/sieve.c b/common/sieve.c new file mode 100644 index 000000000..8150f2d98 --- /dev/null +++ b/common/sieve.c @@ -0,0 +1,51 @@ +#include "alloc.h" +#include "libcflat.h" + +static int sieve(char* data, int size) +{ + int i, j, r = 0; + + for (i = 0; i < size; ++i) + data[i] = 1; + + data[0] = data[1] = 0; + + for (i = 2; i < size; ++i) + if (data[i]) { + ++r; + for (j = i*2; j < size; j += i) + data[j] = 0; + } + return r; +} + +static void test_sieve(const char *msg, char *data, int size) +{ + int r; + + printf("%s:", msg); + r = sieve(data, size); + printf("%d out of %d\n", r, size); +} + +#define STATIC_SIZE 1000000 +#define VSIZE 100000000 +char static_data[STATIC_SIZE]; + +int main(void) +{ + void *v; + int i; + + printf("starting sieve\n"); + test_sieve("static", static_data, STATIC_SIZE); + setup_vm(); + test_sieve("mapped", static_data, STATIC_SIZE); + for (i = 0; i < 3; ++i) { + v = malloc(VSIZE); + test_sieve("virtual", v, VSIZE); + free(v); + } + + return 0; +} diff --git a/riscv/sieve.c b/riscv/sieve.c index 8f14a5c3d..fe299f309 120000 --- a/riscv/sieve.c +++ b/riscv/sieve.c @@ -1 +1 @@ -../x86/sieve.c \ No newline at end of file +../common/sieve.c \ No newline at end of file diff --git a/s390x/sieve.c b/s390x/sieve.c index 8f14a5c3d..fe299f309 120000 --- a/s390x/sieve.c +++ b/s390x/sieve.c @@ -1 +1 @@ -../x86/sieve.c \ No newline at end of file +../common/sieve.c \ No newline at end of file diff --git a/x86/sieve.c b/x86/sieve.c deleted file mode 100644 index 8150f2d98..000000000 --- a/x86/sieve.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "alloc.h" -#include "libcflat.h" - -static int sieve(char* data, int size) -{ - int i, j, r = 0; - - for (i = 0; i < size; ++i) - data[i] = 1; - - data[0] = data[1] = 0; - - for (i = 2; i < size; ++i) - if (data[i]) { - ++r; - for (j = i*2; j < size; j += i) - data[j] = 0; - } - return r; -} - -static void test_sieve(const char *msg, char *data, int size) -{ - int r; - - printf("%s:", msg); - r = sieve(data, size); - printf("%d out of %d\n", r, size); -} - -#define STATIC_SIZE 1000000 -#define VSIZE 100000000 -char static_data[STATIC_SIZE]; - -int main(void) -{ - void *v; - int i; - - printf("starting sieve\n"); - test_sieve("static", static_data, STATIC_SIZE); - setup_vm(); - test_sieve("mapped", static_data, STATIC_SIZE); - for (i = 0; i < 3; ++i) { - v = malloc(VSIZE); - test_sieve("virtual", v, VSIZE); - free(v); - } - - return 0; -} diff --git a/x86/sieve.c b/x86/sieve.c new file mode 120000 index 000000000..fe299f309 --- /dev/null +++ b/x86/sieve.c @@ -0,0 +1 @@ +../common/sieve.c \ No newline at end of file