Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8429219rwl; Tue, 10 Jan 2023 13:30:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXu7CDZex9c0//Ph0E8ymXY6ok2KvzZ+OsHL2avo4na9arVN0Fh1SGuB9lrOlO9zvuwuJiq+ X-Received: by 2002:aa7:d698:0:b0:498:2f9f:3442 with SMTP id d24-20020aa7d698000000b004982f9f3442mr10926507edr.2.1673386226574; Tue, 10 Jan 2023 13:30:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673386226; cv=none; d=google.com; s=arc-20160816; b=nE/NZQ6GvMbLcMBfKQqy6bgmlRzWOjxm5BT1PlCuH7Xa7ZBbmsz70aKwBgdbsqk1nu aHzF4LgqQSG0LCOis2U0xcEv9fXJjiAdHKHt9F5Qh6/yFJ166ROkxFYEAPqDksUK7IAp 24tShNB7vy85izn8KZ5nDeY4hztKUUuwYML2RDPLdqgAUYx/M5j+VU60gzkP5bLoD72D TRRzqcwoYJy1L8EbFUDjRJdh9Cm6qVF0hCVV8gAVyDAZ6jSc9ayTgykmfJaZUzXO7tVO oUSInrBfyaRFIL4U+9MNCL2uxnCU11xcAGcYjIejURcllv8R3WNEa6dz3XnqwNUMhonE Q22Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=adAxM/tdxethfCc9kWsVP4uZeaLxTRj54+QnNFBkUNY=; b=v/m/oNRsAl71oxCEC9BjIIGBZv2M1phLd4e5qYMA+OWp2k6jxmMPSC5MZkCFDYTk5+ pmoUha+4BmE3t2RnJmSHANBBlxTXF9KoOce8uhdds7d3MwNyYAtJsFmWmduQ4tokVHAT r4Ny+vNX/bngyR0+TIaPd1BGNbQjh5vAXGFDZqlDGBvoD6xDkoQ+FU5i/LbPYcWj6by1 UtSbRrI62yaLmEuNtErWtlLRljLLStmuliIM81UcL3AfdH/iYjmv3toe+ohGi3EYzptV C3M0Y4MTV+ABK0mXe7BILgeHluRfEqoggyQoKVu3oc8iXtpfi5wWr8Gh77u9zZhG95bl ETkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=q6L5OgUT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a056402354800b00495c661fb42si14854184edd.571.2023.01.10.13.30.13; Tue, 10 Jan 2023 13:30:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=q6L5OgUT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231727AbjAJUi1 (ORCPT + 53 others); Tue, 10 Jan 2023 15:38:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232123AbjAJUiZ (ORCPT ); Tue, 10 Jan 2023 15:38:25 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F47485BE for ; Tue, 10 Jan 2023 12:38:23 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id bj3so10429111pjb.0 for ; Tue, 10 Jan 2023 12:38:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=adAxM/tdxethfCc9kWsVP4uZeaLxTRj54+QnNFBkUNY=; b=q6L5OgUTT+UTRnL01un1afM9agRNUadY7z3gcTMkTail3+Qhky05OYeoYhqXQYg/2V oNM0bJF76X8c1a11DiRZwcxUUHYL3WCdBjquE+qsCek2XUUM0gXKs5jgYWAsvJKFOq3s 2lnuRusHfIRnNbb9jdGjYhKOTOw50LK1/BLu87Zi/Mpo+hASVtgSMMzyjjmxYUTFskob p27WyREJ+flNoKcGO2HMB4eNUNOHlrLrKCJ+wJHvQBcRyydwzjIxEbXRXn1ARZZEyQGa CjT+HPcFde0Kq8RXE0OBr1Oysi/okt8jgq4il6jxujPqUwEvyhWt1lPGGK2sbFlYhhn8 ZxZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=adAxM/tdxethfCc9kWsVP4uZeaLxTRj54+QnNFBkUNY=; b=rMq9c+p8c7RjcURioH69BA8k8/mk9XBKTbUEyaLMvskQRrVbqiynQkirrIHN0ATTzk PtRtoIsENsmx8HMZSuyneGiSEzUYs/qGkYq551rJmsXjOP77/SRbeHWeUXaTKxGfHyqO wEPGPCCma02pAVp/Hm8p2xBzDCoXTzYOczLbEll2iE40Q/5PRVqja7aPVRG30rRh94iG EJR32IMx/f99cJAYWecTmH1Wtj30amQA+Iasv9jzbK+dRKxjLVcbhrU5rw8JqeFDLY96 E7pylT8p0bT0gpLnr75uyJcUWFEWSxe0x6nRjQUXfo2ivsKG2A8dEDycdJmC6BAi+A+8 dLXg== X-Gm-Message-State: AFqh2kqXy9gdzrEn8rzKZ6l1dB3OtOL6H++ChmeFau02reI5y/meCI+g dAvoErJ5ym7ek8sSLaDKtM9OJPVPMstrTXHXgdn7+Q== X-Received: by 2002:a17:90b:4b4c:b0:219:6be1:7ff2 with SMTP id mi12-20020a17090b4b4c00b002196be17ff2mr6404270pjb.79.1673383103232; Tue, 10 Jan 2023 12:38:23 -0800 (PST) MIME-Version: 1.0 References: <20230107040203.never.112-kees@kernel.org> In-Reply-To: From: Daniel Latypov Date: Tue, 10 Jan 2023 12:38:11 -0800 Message-ID: Subject: Re: [PATCH] kunit: memcpy: Split slow memcpy tests into MEMCPY_SLOW_KUNIT_TEST To: Vlastimil Babka Cc: Geert Uytterhoeven , Kees Cook , Guenter Roeck , Andrew Morton , Nathan Chancellor , linux-hardening@vger.kernel.org, David Gow , Nick Desaulniers , Josh Poimboeuf , Miguel Ojeda , Isabella Basso , Dan Williams , Rasmus Villemoes , linux-kernel@vger.kernel.org, Brendan Higgins , "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 9, 2023 at 11:51 PM Vlastimil Babka wrote: > > +Cc rest of kunit from MAINTAINERS > > On 1/7/23 11:55, Geert Uytterhoeven wrote: > > Hi Kees, > > > > On Sat, Jan 7, 2023 at 5:02 AM Kees Cook wrote: > >> Since the long memcpy tests may stall a system for tens of seconds > >> in virtualized architecture environments, split those tests off under > >> CONFIG_MEMCPY_SLOW_KUNIT_TEST so they can be separately disabled. > >> > >> -static void init_large(struct kunit *test) > >> +static int init_large(struct kunit *test) > >> { > >> + if (!IS_ENABLED(CONFIG_MEMCPY_SLOW_KUNIT_TEST)) { > >> + kunit_skip(test, "Slow test skipped. Enable with CONFIG_MEMCPY_SLOW_KUNIT_TEST=y"); > > > > So I can't make the slower tests available for when I need them, > > but not run them by default? > > Indeed it seems weird to tie this to a config option without runtime override. > > > I guess that's why you made MEMCPY_SLOW_KUNIT_TEST tristate originally, > > to have a separate module with the slow tests? > > On the other hand I can imagine requiring a separate module for slow tests > would lead to more churn - IIUC there would need to be two files instead of > memcpy_kunit.c, possibly a duplicated boilerplate code (or another shared .c > file). > > So the idea is to have a generic way to mark some tests as slow and a way to > opt-in/opt-out for those when running the tests. Maybe KUnit folks already > have such mechanism or have an idea how to implement that. There is no mechanism atm, and we'd still need to figure it out so it'll be a while. So I think a patch like this makes sense in the short-term. This is definitely something we've always thought would be useful eventually. See this TODO which has been there since day 1 ;) https://elixir.bootlin.com/linux/latest/source/lib/kunit/try-catch.c#L36 It just felt like it would be premature to come up with something when basically all the tests up until now ran ~instantly. Throwing out some rough implementation ideas: I was thinking the granularity for these timeout annotations would be at the suite-level. If we go with that, then I guess the intended flow is to group slow tests into their own suite and mark them as such. Then maybe we'd have some runtime way of disabling/enabling "long" tests, like a cmdline opt. E.g. you'd pass `kunit.max_test_size=30` to exclude tests longer than 30 seconds. Daniel