Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp553767pxv; Thu, 15 Jul 2021 10:07:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAN+XpUGSHC4TGTYQGFsTOWLDW2Bn+hjffkc8hk5Cf84d5ChV38O2ITPAf9V2iHy4dafan X-Received: by 2002:a05:6402:d4c:: with SMTP id ec12mr8586021edb.246.1626368838709; Thu, 15 Jul 2021 10:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626368838; cv=none; d=google.com; s=arc-20160816; b=T8lPaAFPFpOT3A/h3S7hOmato8/n7SsbsfM9+Z+jPe4omSkh/gLiFUyaywQrhHvCIg 37sLf72WwLkbH0KHUYfrGbNYdBy/2Z24AX3hQZImYUbL86GHPcrtjJlu19obz5ULBVUn /rbzlE9VZQ39F04wSvzfm7MuBgldH24iECzH3eCPMT/AdXua+Bawh2icYVXgrI1n1ulO SBQwuMou6U2+s0cw3iTumSRk/0wSV943HHoIjJPBDiLT7uHjcNGk/asDDetppdVqfcKL ogxEO6jqDuIbbpg/55wu989m6JT85Ha5rlDEKDEYPgMhI5omCYJ+53/BFdVTle93VA+2 BQEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=FpstuIIN0DB2WHE/Hcl2SOa1IWvxixa590FX0bfpwfE=; b=uxFwLcqFvzcdus8+sQwkTuTCdIIP42oIztrTkyILj3P0VxDJtk7Xkft8LMZtbOT3vL RERVB7XnvMfRaUp5LGscPBdCshfBpZtEuIPwRNYXsSQm+84qj1h2nKrgfRF6gpo3uZ7M jKWxrUw91roK9RsNPY2nXc2iU9eIg4MIDVNVtc2uBtT3B5cMmftEE8010RE8Zuz8pXBN ZNnshifIQ4oc1+elIfTXlxp200th2AP7aDyK0WvYSssoEI8VxD4KoAbDTnjqp/Bkub7p bugWw6L0RYNa8DrUBnVIgG8HMn5nHyzYoq54E6kKEOfU59GlaXS06GqXdQQ07GHB2Gf3 hNRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BdAJ+gTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v9si4192702ejk.222.2021.07.15.10.06.51; Thu, 15 Jul 2021 10:07:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BdAJ+gTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230193AbhGOQg0 (ORCPT + 99 others); Thu, 15 Jul 2021 12:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbhGOQg0 (ORCPT ); Thu, 15 Jul 2021 12:36:26 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9107AC06175F; Thu, 15 Jul 2021 09:33:32 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id u8-20020a7bcb080000b02901e44e9caa2aso4038325wmj.4; Thu, 15 Jul 2021 09:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=FpstuIIN0DB2WHE/Hcl2SOa1IWvxixa590FX0bfpwfE=; b=BdAJ+gTPLbBFZP4N6+1Ryck8w3TjNik+tH0tKPVpaqDJsxVu9skZDfKZSW3DX7RPkg kaPuZIt4iRW7kD1YMBBI9KsMmxC6Zl/FQTuOKIU8x0LD8FB389rDMrxZfyN9/yalKn/f 6q6FkTiApz7DT7lawHd2XvSUdK8Enz5bpxrZDpHlTKI3Su7BZ/X4mquHetv8I8w2h2Sz dRpRY4bS/Moer7MkzRBZ1t7lbEKHdHWyszxIxbhOMo3ILBAZki0v/+QLM6dEvK0eI1fK Ws/62NdmmHEaJWJILTaqFZVNkwPP5fBFbCX6OADcVaInZkepGTN6leKHXR+CTneaRGYG jZeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=FpstuIIN0DB2WHE/Hcl2SOa1IWvxixa590FX0bfpwfE=; b=rVMWMjmXhjpdMNiSFgUpIuqJuz/eYbe049VcvGRaLXfowc4GpQZhdvTeJRvgGxS8t5 geS0DVbUfEZRGYoRRYnPsmKVVHX/oQCZs3DKGJ7rc05T8WVUr2CtAsGz6IUOxiP2XVTM 90mCnbbIBja6MmBpKED/X9miKjcgTAfna52tr8i9JmjExZHpsWaL6USO0wRHJIeuCFtM j8WykoXcgOfTH1qn2pHQj9ULFRqP5kU0UwxL8pft70kRw4pb+obdC1rUQMC+DlUoqN+N eeZKbHl4nt4mXWl8EqvCFIojSuVvyvCrDUSxqpHmOgNZmkmAn67u5yozZjcYL5CFfBCU 3eww== X-Gm-Message-State: AOAM533DZhuG8IandGnI7dwcqRmQ+kcypyDyfl7euLDLszI7KftOilw+ DRm8S5QpkRkHBP2txMyWZaI= X-Received: by 2002:a05:600c:5107:: with SMTP id o7mr5600699wms.184.1626366810818; Thu, 15 Jul 2021 09:33:30 -0700 (PDT) Received: from ?IPv6:2001:b07:6456:fd99:ced0:db1c:53e1:191e? ([2001:b07:6456:fd99:ced0:db1c:53e1:191e]) by smtp.gmail.com with ESMTPSA id i12sm7069635wrp.57.2021.07.15.09.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 09:33:30 -0700 (PDT) Message-ID: <959c58526c5388eb891fd8a5927b5abc08c46a58.camel@gmail.com> Subject: Re: [RFC PATCH 02/10] perf tests: add test for workqueue From: Riccardo Mancini To: Arnaldo Carvalho de Melo Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Date: Thu, 15 Jul 2021 18:33:29 +0200 In-Reply-To: References: <333e2e3986d32cf8894105f149abb543a84ec91c.1626177381.git.rickyman7@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.2 (3.40.2-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnaldo, On Wed, 2021-07-14 at 12:10 -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, Jul 13, 2021 at 02:11:13PM +0200, Riccardo Mancini escreveu: > > It will have subtests testing threadpool and workqueue separately. > > This patch only introduces the first subtest, checking that the > > threadpool is correctly created and destructed. > > This test will be expanded when new functions are added in next > > patches. > > > > Signed-off-by: Riccardo Mancini > > + > > + > > +static int __test__threadpool(void *_args) > > +{ > > +       struct threadpool_test_args_t *args = _args; > > +       struct threadpool_struct *pool; > > +       int ret; > > + > > +       ret = __threadpool__prepare(&pool, args->pool_size); > > Turn the last three lines into one; ok > >         int ret = __threadpool__prepare(&pool, args->pool_size); > > > +       if (ret) > > +               return ret; > > + > > +       ret = __threadpool__teardown(pool); > > +       if (ret) > > +               return ret; > > + > > +       return 0; > > Humm, will you add something here in the following csets? Otherwise turn > these 5 lines into one: > >         return __threadpool__teardown(pool); ok, it was just copy-paste from above. Thanks, Riccardo > > > +} > > + > > +static const struct threadpool_test_args_t threadpool_test_args[] = { > > +       { > > +               .pool_size = 1 > > +       }, > > +       { > > +               .pool_size = 2 > > +       }, > > +       { > > +               .pool_size = 4 > > +       }, > > +       { > > +               .pool_size = 8 > > +       }, > > +       { > > +               .pool_size = 16 > > +       } > > +}; > > + > > +struct test_case { > > +       const char *desc; > > +       int (*func)(void *args); > > +       void *args; > > +       int n_args; > > +       int arg_size; > > +}; > > + > > +static struct test_case workqueue_testcase_table[] = { > > +       { > > +               .desc = "Threadpool", > > +               .func = __test__threadpool, > > +               .args = (void *) threadpool_test_args, > > +               .n_args = (int)ARRAY_SIZE(threadpool_test_args), > > +               .arg_size = sizeof(struct threadpool_test_args_t) > > +       } > > +}; > > + > > + > > +int test__workqueue(struct test *test __maybe_unused, int i) > > +{ > > +       int j, ret = 0; > > +       struct test_case *tc; > > + > > +       if (i < 0 || i >= (int)ARRAY_SIZE(workqueue_testcase_table)) > > +               return -1; > > + > > +       tc = &workqueue_testcase_table[i]; > > + > > +       for (j = 0; j < tc->n_args; j++) { > > +               ret = tc->func(tc->args + (j*tc->arg_size)); > > +               if (ret) > > +                       return ret; > > +       } > > + > > +       return 0; > > +} > > + > > + > > +int test__workqueue_subtest_get_nr(void) > > +{ > > +       return (int)ARRAY_SIZE(workqueue_testcase_table); > > +} > > + > > +const char *test__workqueue_subtest_get_desc(int i) > > +{ > > +       if (i < 0 || i >= (int)ARRAY_SIZE(workqueue_testcase_table)) > > +               return NULL; > > +       return workqueue_testcase_table[i].desc; > > +} > > -- > > 2.31.1 > > >