Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2812168lqz; Wed, 3 Apr 2024 09:13:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7q0P2f0poM5K3rwJypqQ7LOBMFx12Vm5KnVW+Qf0SjRux1VYwaQ0qORikjkV1jM4AHQXWhWBf7nz/dAjDGUtUlVcu/Lqm7RxlHIrO1w== X-Google-Smtp-Source: AGHT+IGAZU5e/p6ZC87SotqSf+aksb7y1Y7xTm6bBJxKInRQjFVv2BaEMKhNJR7GGwM2DAy8O4QU X-Received: by 2002:a17:902:c94f:b0:1dd:a912:2db3 with SMTP id i15-20020a170902c94f00b001dda9122db3mr17225962pla.17.1712160824878; Wed, 03 Apr 2024 09:13:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712160824; cv=pass; d=google.com; s=arc-20160816; b=U6nK6QwpEfCyk9RZGUK2FkZsDborEhr3zDgu9ogfOKN0bhFGOXznfEp/hI0IosRRnE /9Mh2T451zFDSBMYMRSbcLEdUq0aq/k8JK2MjGpEv2O1EHVabPvyIR+1VqJfhd0tDBAT Dg1gn7Wqvc3T59y00p6TgoOsYLX7AAZ1QXCumc5XVg8KRSe6y9hQdVbD+eJiW27H7Xau QS+Fq16D5oMLXu6JGw3N2UOg5ks+fl4LJoyCZvG+vNyYt1jQUBSwTR1KsmHe6Kac+oX/ 5ASV/iaGlBETY+z45hXBuUU1CoLs5Yv/JZ9FeE2cAL3MB30jTSbKI9cpQQGNVnh7oQTJ oGHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=cks1TbEs8JVrdHfzbx//XLDlYbdIXdszil0z5Xy7N/A=; fh=fLWR3Uz/efmlQn2g8PUgSrEEt7hfhu8D80jhyRNYZgU=; b=xBpcJrhR+BfBN7nI1K8f7ROzTBjips4huIQwEwBQR599bVU4orY4BXc5bO8Fsz9Xez Pm49wcEA/Zm6ZFu1P1nIysFqTC6CmgycebhcpXe3cfG69+uOUBt5FeZg8lmIEm2JZXiw uav++9y4QlU22bmDF2MMXk66tyd9h2Qx9eqsGwVB88GnxLN8UGgc2AnqvnCX7zevCTmr /uOCAtYk2WeiSsu2Ey+cQK4VKHvmY9jIlFAIFsyAchji9elNsu8+m6xhKorJPmDoh9eJ EX0ofgz5KKAT/3DGmP0feDEp4WrLwkgRQdA7ra8kF7Y16+6+46GFz0Cy1Fz0S7J97SUV 7Ovw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QKSKP8k9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130096-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130096-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9-20020a170902728900b001e0096b286bsi12430493pll.632.2024.04.03.09.13.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:13:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130096-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QKSKP8k9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130096-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130096-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B9BCAB2FD45 for ; Wed, 3 Apr 2024 15:33:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C53EE14A4CA; Wed, 3 Apr 2024 15:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QKSKP8k9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4633139D17; Wed, 3 Apr 2024 15:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712158407; cv=none; b=pqQfDb88T6QGp87PRGVRWr6KvXUfGh732vtKix05rcvvUEGl3bQ5TGpYtlQmjxjUcp1cJahGZAi2P5B+MV1OU4OOtonaUlw89wq9hv6TsJQr3gyxgNrxCveBp0jOHOLqUfi1g+goa5LaKbf80jrJu72eYJE08/t48T9pOfvnQ6Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712158407; c=relaxed/simple; bh=HyRVKVZLib2Qi5jNnjsMMZBqiCB0TsCEtOsioaftDFM=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=jBg4H25Q6UuKs7hxbvV65aqGDtKKp90LOUEB9V8aA3we0wzBcrfQ2VLFzG96mIaaz0pFFd5KHZflZ/FP3UXEE6u9ulbdCoDrWSYLDska9QAznWhYC6hMJpJMq3wGmGsBxb6+3jBs8nf5IyqRluS+dlGs4n+UymI9R2XSqOKMAF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QKSKP8k9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1356CC433C7; Wed, 3 Apr 2024 15:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712158406; bh=HyRVKVZLib2Qi5jNnjsMMZBqiCB0TsCEtOsioaftDFM=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=QKSKP8k9E0RIb0YQFAOClleU8yl67e7l5fuoahSVZklTWnFKmag6DeIELlvJS3XF2 1SPFgMK7KkrFGiKOYqtM0WuAHzgJOUJJfJYwe+dCFMizkP0+Hm827qe3ORTst70SEF jf2/6sRiK691LLVhH7qIKlGPvSqWxSfQymBddtCSbxlkw0hu2ma9JFYru2Do+5efqt +U0Cbs+P7n44HUL+9JU1j3hqkiciTgRerfYT7ZpYd3ieMHMcrURaf6sWjnomY2WCNH 0lqwX2bgfZVW3ks8w2q0FrHhbtm/ll2FLLE93UuPF93P+xRZ9w8wrvInsMo46Wtrj6 6ewpXop4JyptA== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 03 Apr 2024 18:33:20 +0300 Message-Id: Cc: , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v9 15/15] selftests/sgx: Add scripts for EPC cgroup testing From: "Jarkko Sakkinen" To: "Haitao Huang" , =?utf-8?q?Michal_Koutn=C3=BD?= X-Mailer: aerc 0.17.0 References: <20240205210638.157741-1-haitao.huang@linux.intel.com> <20240205210638.157741-16-haitao.huang@linux.intel.com> <4be7b291010973c203ed8c7bcd25b626c1290231.camel@kernel.org> In-Reply-To: On Tue Apr 2, 2024 at 7:20 PM EEST, Haitao Huang wrote: > On Tue, 02 Apr 2024 06:58:40 -0500, Jarkko Sakkinen = =20 > wrote: > > > On Tue Apr 2, 2024 at 2:23 PM EEST, Michal Koutn=C3=BD wrote: > >> Hello. > >> > >> On Sat, Mar 30, 2024 at 01:26:08PM +0200, Jarkko Sakkinen =20 > >> wrote: > >> > > > It'd be more complicated and less readable to do all the stuff = =20 > >> without the > >> > > > cgroup-tools, esp cgexec. I checked dependency, cgroup-tools onl= y =20 > >> depends > >> > > > on libc so I hope this would not cause too much inconvenience. > >> > > > >> > > As per cgroup-tools, please prove this. It makes the job for more > >> > > complicated *for you* and you are making the job more complicated > >> > > to every possible person in the planet running any kernel QA. > >> > > > >> > > I weight the latter more than the former. And it is exactly the > >> > > reason why we did custom user space kselftest in the first place. > >> > > Let's keep the tradition. All I can say is that kselftest is > >> > > unfinished in its current form. > >> > > > >> > > What is "esp cgexec"? > >> > > >> > Also in kselftest we don't drive ultimate simplicity, we drive > >> > efficient CI/QA. By open coding something like subset of > >> > cgroup-tools needed to run the test you also help us later > >> > on to backtrack the kernel changes. With cgroups-tools you > >> > would have to use strace to get the same info. > >> > >> FWIW, see also functions in > >> tools/testing/selftests/cgroup/cgroup_util.{h,c}. > >> They likely cover what you need already -- if the tests are in C. > >> > >> (I admit that stuff in tools/testing/selftests/cgroup/ is best > >> understood with strace.) > > > > Thanks! > > > > My conclusions are that: > > > > 1. We probably cannot move the test part of cgroup test itself > > given the enclave payload dependency. > > 2. I think it makes sense to still follow the same pattern as > > other cgroups test and re-use cgroup_util.[ch] functionaltiy. > > > > So yeah I guess we need two test programs instead of one. > > > > Something along the lines: > > > > 1. main.[ch] -> test_sgx.[ch] > > 2. introduce test_sgx_cgroup.c > > > > And test_sgx_cgroup.c would be implement similar test as the shell > > script and would follow the structure of existing cgroups tests. > > > >> > >> HTH, > >> Michal > > > > BR, Jarkko > > > Do we really want to have it implemented in c? There are much fewer lines= =20 > of code in shell scripts. Note we are not really testing basic cgroup =20 > stuff. All we needed were creating/deleting cgroups and set limits which = I =20 > think have been demonstrated feasible in the ash scripts now. > > Given Dave's comments, and test scripts being working and cover the cases= =20 > needed IMHO, I don't see much need to move to c code. I can add more case= s =20 > if needed and fall back a c implementation later if any case can't be = =20 > implemented in scripts. How about that? We can settle to: ash + no dependencies. I guess you have for that all the work done already. BR, Jarkko