Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2561926ybf; Mon, 2 Mar 2020 11:07:10 -0800 (PST) X-Google-Smtp-Source: ADFU+vsa27v8ozmRlhCTVaMdmGVf5p0igAiEhdvH7mSi+SrDORfLmE72Ctl+Xv71IA4NgmoZOmGo X-Received: by 2002:a54:4396:: with SMTP id u22mr4112oiv.128.1583176029778; Mon, 02 Mar 2020 11:07:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583176029; cv=none; d=google.com; s=arc-20160816; b=CaeDrEA272L4ejoiJ2Wo453dX+0Vcewywp5WPJb9U5dSGt31H/O8VFDDmVA0oeCJ0o 0YAvQ/AYP0DZBDMnGh8rCzOO8f4V6mVsMfcHX3K1QogPsygWDmAuZDhITBSiNn7p2Xta fwToTEY9u61nEAZ454KslwW+iVVfPkpT50rqD6YJ6Jb2rUB/mUFZaQeYKhGEyQhygIl6 dyG5AHgwPEJ3mey//s+8eeBaTnOd/v9kOHY/JwkUZ2U9aOYQt3nexYpC++J/AjAGBLda f3dciL9EJNfp/b+c4AuI8eEtI3GfzR9UsKdkVz3N18WWn43ivLUmrrMJBmJlG2w//Ey4 ID4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=gf4KSaQWKca7V96I6NmHZqh2rr9VA3G/cTKK6IvZdwg=; b=mF5ZZWBnAIWdx+XI6J+ls1NjxGo/RgCaPM/Unzjp666UT5UewiJPua3gI7nTaMQF6U 18kWXOk/NI6MjWcvLCkc/4wK89srTPnZOXyBgzh6EP2sizA6L6UD+5qoqC8HNf78HYuW 2vAqSWGEaqXVTyOn2nV2BvaTIZrKdv4xHDSo1womr/HkDHeDyGnpKz+QORl/H9lLeTRJ LSusz14MpiA9PSOU2FWQjmDK2ZrL0Kk7gliHVWu+62Y2lh/oxWsH/14x0qBP06uo4Tkr ZieJHIX95gmMBf78gmaVq80ReoA63gorCgZ9YgK6xcDiXmOc++fBAUvqNPkOtythdP2K VCIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si6589598otk.244.2020.03.02.11.06.55; Mon, 02 Mar 2020 11:07:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbgCBTFl (ORCPT + 99 others); Mon, 2 Mar 2020 14:05:41 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:56000 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727372AbgCBTFl (ORCPT ); Mon, 2 Mar 2020 14:05:41 -0500 Received: by mail-pj1-f66.google.com with SMTP id a18so193018pjs.5; Mon, 02 Mar 2020 11:05:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gf4KSaQWKca7V96I6NmHZqh2rr9VA3G/cTKK6IvZdwg=; b=M3wS+vGjF7lbZ/LzvbJSTd4fCwPjEpwyFf/ZLO4/MgcJej+bUl+ydkb7bDe/0/y/bD FlyBdFKSQBOu98Ly3sNiEK3q+8YvjAOMT1Sv1EQlHO1TcO1TOvfgTRZw1oubXKVXHdQV bICe/QTdxsr3v3q3AxbzxdJJB8fXUyBDgFTN6rSD/l11w1CtYMj3iHnHRj6+jyNf8Czr PazZJgP1un2PG/fKUNLepXXPb6CvsZmfzuHi/Mvco1LBfDdCZzaiIVZfhAYRCCyh94RI H87wDd/zD2ov9RtUhAVIyAUbZ2vvCz0NZ1wvfALUaB3cTxNcIPNtFwJ3/FLczOoy1M+p rJnw== X-Gm-Message-State: ANhLgQ1DFPZYAS+xbicRGYfuaT2KL7Sw+eqOQ0rASa6s0jT1gy5ktw1U JWx1cXyyXlFvDc8NKr+mg64= X-Received: by 2002:a17:90a:8915:: with SMTP id u21mr350863pjn.87.1583175939331; Mon, 02 Mar 2020 11:05:39 -0800 (PST) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id t63sm22345163pfb.70.2020.03.02.11.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2020 11:05:38 -0800 (PST) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 4C2C34035F; Mon, 2 Mar 2020 19:05:37 +0000 (UTC) Date: Mon, 2 Mar 2020 19:05:37 +0000 From: Luis Chamberlain To: Brendan Higgins Cc: Jeff Dike , Richard Weinberger , Anton Ivanov , Arnd Bergmann , Kees Cook , Shuah Khan , Alan Maguire , Iurii Zaikin , David Gow , Andrew Morton , rppt@linux.ibm.com, Greg KH , Stephen Boyd , Logan Gunthorpe , Knut Omang , linux-um , linux-arch@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development , Linux Kernel Mailing List Subject: Re: [RFC v1 0/6] kunit: create a centralized executor to dispatch all KUnit tests Message-ID: <20200302190537.GC11244@42.do-not-panic.com> References: <20191216220555.245089-1-brendanhiggins@google.com> <20200106224022.GX11244@42.do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 23, 2020 at 02:40:31PM -0800, Brendan Higgins wrote: > On Mon, Jan 6, 2020 at 2:40 PM Luis Chamberlain wrote: > > On Mon, Dec 16, 2019 at 02:05:49PM -0800, Brendan Higgins wrote: > > dispatcher could be configurable to run at an arbirary time after boot. > > If there are not immediate use cases for that though, then I suppose > > this is not a requirement for the dispatcher. But since there exists > > another modular test framework with its own dispatcher and it seems the > > goal is to merge the work long term, this might preempt the requirement > > to define how and when we can dispatch tests post boot. > > > > And, if we're going to do that, I can suggest that a data structure > > instead of just a function init call be used to describe tests to be > > placed into an ELF section. With my linker table work this would be > > easy, I define section ranges for code describing only executable > > routines, but it defines linker tables for when a component in the > > kernel would define a data structure, part of which can be a callback. > > Such data structure stuffed into an ELF section could allow dynamic > > configuration of the dipsatching, even post boot. > > The linker table work does sound interesting. Do you have a link? Sure https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20170620-linker-tables-v8 I had dropped this long ago mostly due to the fact that my use case (removal of dead code) was more long term, and not immediate so the use case wasn't there yet. I have been meaning to pick this work up again. > I was thinking about dynamic dispatching, actually. I thought it would > be handy to be able to build all tests into a single kernel and then > run different tests on different invocations. For built-in code it would be up to it to manage that. The linker table stuff would just allow a way for you to systematically aggregate data into an ELF section in a generic way. It does have a built in light weight sort mechanism, if you opt out of that and say wanted to do your own order it'd be up to how you program it in on the data structure and dispatching after that. > Also, for post boot dynamic dispatching, you should check out Alan's > debugfs patches: > > https://lore.kernel.org/linux-kselftest/CAFd5g46657gZ36PaP8Pi999hPPgBU2Kz94nrMspS-AzGwdBF+g@mail.gmail.com/T/#m210cadbeee267e5c5a9253d83b7b7ca723d1f871 > > They look pretty handy! Sure. > > I think this is a good stepping stone forward then, and to allow > > dynamic configuration of the dispatcher could mean eventual extensions > > to kunit's init stuff to stuff init calls into a data structure which > > can then allow configuration of the dispatching. One benefit that the > > linker table work *may* be able to help here with is that it allows > > an easy way to create kunit specific ordering, at linker time. > > There is also an example of addressing / generalizing dynamic / run time > > changes of ordering, by using the x86 IOMMU initialization as an > > example case. We don't have an easy way to do this today, but if kunit > > could benefit from such framework, it'd be another use case for > > the linker table work. That is, the ability to easilly allow > > dynamically modifying run time ordering of code through ELF sections. > > > > > In addition, by dispatching tests from a single location, we can > > > guarantee that all KUnit tests run after late_init is complete, which > > > was a concern during the initial KUnit patchset review (this has not > > > been a problem in practice, but resolving with certainty is nevertheless > > > desirable). > > > > Indeed, the concern is just a real semantics limitations. With the tests > > *always* running after all subsystem init stuff, we know we'd have a > > real full kernel ready. > > Yep. > > > It does beg the question if this means kunit is happy to not be a tool > > to test pre basic setup stuff (terminology used in init.c, meaning prior > > to running all init levels). I suspect this is the case. > > Not sure. I still haven't seen any cases where this is necessary, so I > am not super worried about it. Regardless, I don't think this patchset > really changes anything in that regard, we are moving from late_init > to after late_init, so it isn't that big of a change for most use > cases. > > Please share if you can think of some things that need to be tested in > early init. If and when we get to that point we can deal with it then. My instincts tell me that for early init code we should probably be specially crafted tests and have they should have their own hand crafted dispatchers. Luis