Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp664052pxb; Wed, 22 Sep 2021 10:05:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKPq/VSBKqikY5gliPkU6esXwU2jObIUudPkd3+1VsvtMI2wlbWp+ISpRkMEL9S5BYeZcr X-Received: by 2002:a05:6602:25d4:: with SMTP id d20mr34154iop.135.1632330342563; Wed, 22 Sep 2021 10:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632330342; cv=none; d=google.com; s=arc-20160816; b=z1wxau6Mtm//Lol7NjFSX87Zfx5vrxDv/9h45N7apfwVuwB1cbkOerZBqTS55wFDyZ zYlNEfBYUhAD+m5Mt7j9v6aUYqlMUA71tUOHO+CdSpH1LFeY8o00Mquc1ziKv4hOivtb 1sm8lPukzPwrwYfAh4SL/FCjnBR1WJXC1WSk2gHh+qfCCy+vWo6RPPH5JKh0lmMOlPUa 4rYNGE1wrwROqSmvOfE3n4JVL93Iruc8m1F6VWI578Emxc7sVmoBcjzx2hJyNLKD3aPI xTwgoT2UnwIBgYrz9mpy+POFj+TxtpmwlTdlXgBHj7UV8tAribNSoEvSnKEL7/9o6vZz hsMg== 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=6Ux03cG5hBPJ9MQ2bUemW8lwVWLAct1mE8axUh1mK6k=; b=V2Oe102PAyYNkWsN3WH723q3sAn5tA4js/9ks+s35GMuvMHjApau1+RWNCjZWZxdX3 PdDlVVLSrwED6M+p76NaLC1kTzZFO8aKfmoE8SJ7u4Nj+/MnutIXTO+PsxR8sxg5RTIo XGn1wehwMAqpBLjMk9Qq9NT57dxbZuIIHXHrHULWngKQWfvi52vFb7+EWI2BmIeTROGf sWWvyXsGJgtuR9yQcHinyhE6XnF4GlLC+R/v4jrcq2R6dQfQ7KEOZh6W7F6FwGynCE2D 3zlj9nVkVHbV3NOB3moxyuLvZag4Hh0vQ4XBUksZYcbtWwxSYr54DcuWgNQA4q+uFh6Y nrxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="Z6U/J9MO"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si2933337ilj.28.2021.09.22.10.05.30; Wed, 22 Sep 2021 10:05:42 -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=@google.com header.s=20210112 header.b="Z6U/J9MO"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236735AbhIVRGM (ORCPT + 99 others); Wed, 22 Sep 2021 13:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236689AbhIVRGK (ORCPT ); Wed, 22 Sep 2021 13:06:10 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B3FCC061574 for ; Wed, 22 Sep 2021 10:04:40 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id i13so3506682ilm.4 for ; Wed, 22 Sep 2021 10:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6Ux03cG5hBPJ9MQ2bUemW8lwVWLAct1mE8axUh1mK6k=; b=Z6U/J9MOXmwaNV+2zF5ntuLypdkphil3PjK5ro65TRqO89DHh8u1ndKkc8KqLah1rV v99nt+Du+gWUFK0sn9LyHdJiRBylTtBEBq6YeeXbLq4yaXDOUH1CLuZeqNoiFSjbnB4I mr8TRJoZ+L1Jol1L2QB1qQqlkv1/Y6CoiYPjicVRS3m8qBWdhjEIR2WJzya1A39m1blW ++icpE8GBziVH0LzlbpOdDup4TVgTz8adYh6IxwQ88C2YONiBD0QLxo4ZQalU17Bx4bd 30O6XguWTD14tRIKez+dPQyOOihhIiUVm6bue5FEKlUHLcoaHDlzdgqHoaZ3bFGlD5mo EDEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6Ux03cG5hBPJ9MQ2bUemW8lwVWLAct1mE8axUh1mK6k=; b=dfYB+ntDS9KNtjecITk3UGfdcL2THhWKuq6lw6Pl5nNNfIS3gUNlIJFkqcqEJ0Khg4 dSviM9gv0IemeiW6ZHS121KqhWtJiZcQXHugEA/Y7WkEoFsWTIBHHMGzSwQ6MLt71DU7 sZsCIZ5vhXI7zc88Sl421PixQlOvicr4Q5A0Stu5vbwEG6u75Zd3Ebnu38h1tl5yzyOg r4csBkOrxSwUv9bp2plTrqO4hW9DGQlz1YLdZ3f5DdoKeWNXAg6OoKJYqDi8XrNDPMUa 30tbaxfHNyMNtv7YpIP4WbXlw6C6pIsIOvborAeLHk/as0l1+Fg1kiSwPIWPEi7MYJ2P iHIg== X-Gm-Message-State: AOAM5302SA+BAzZ9XQTTsSP07y/kOK7gEvbLfJnG+VvWJtgImYrA0Qve SQE+I5BxhI/evgJmri6VEkMNrtXjT9tQl4pW9AYsJn1xGnx+LQ== X-Received: by 2002:a92:db0b:: with SMTP id b11mr48933iln.275.1632330279236; Wed, 22 Sep 2021 10:04:39 -0700 (PDT) MIME-Version: 1.0 References: <20210921163323.944352-1-axelrasmussen@google.com> In-Reply-To: From: Axel Rasmussen Date: Wed, 22 Sep 2021 10:04:03 -0700 Message-ID: Subject: Re: [PATCH 1/3] userfaultfd/selftests: fix feature support detection To: Peter Xu Cc: Andrew Morton , Shuah Khan , Linux MM , Linuxkselftest , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for discussing the design Peter. I have some ideas which might make for a nicer v2; I'll massage the code a bit and see what I can come up with. On Tue, Sep 21, 2021 at 5:29 PM Peter Xu wrote: > > On Tue, Sep 21, 2021 at 01:31:12PM -0700, Axel Rasmussen wrote: > > Ah, it has to do with us asserting the list of expected ioctls. The > > kernel changes the list of ioctls it reports in response to a > > UFFDIO_REGISTER, depending on the particular kind of vma being > > registered, **as well as what mode(s) it is being registered with**. > > > > So for example, consider the hugetlb_shared test. When registering, > > the kernel might set the UFFDIO_CONTINUE bit or not, depending on > > whether we registered with the MINOR mode bit set in particular. > > I can understand your point, but the "capability set" of the kernel is still > the same. In this case we should have UFFDIO_CONTINUE capability for > hugetlb_shared test globally, as long as the kernel supports it, irrelevant of > what test case we're going to have. > > Then in the test, if we don't register with MINOR mode, IMHO we should just > mask out the expected_ioctls with UFFDIO_CONTINUE because it does not make > sense to request UFFDIO_CONTINUE if we will never use it in the test. Right, this is how it was before. I didn't love how the base set included everything, and then each test is responsible for removing the things it isn't testing. It seems reversed: why not just have each test compute the set of things it *is* testing? > > In other words, having a "uffd_features" global variable and having it changing > all the time during tests is odd to me, but I agree it's not a big deal. :) 100% agree with this. From my perspective this is tech debt since: 8ba6e86408 userfaultfd/selftests: reinitialize test context in each test It used to be that we just had one global context (variables like uffd, count_verify, area_src, area_dst, etc). But this had the problem where some previous test can mutate the context, breaking or affecting following tests. After 8ba6e86408, we clear and reinitialize all these variables for each test, but they're still global. I think it would be cleaner if these instead were in a struct, which each test initialized and then destroyed within its own scope. If we were to do such a refactor, I would put uffd_features in that struct too - it should be private to a test, since it's a property we get from the uffd. But, I wasn't sure it was worth the churn to do something like this. > > -- > Peter Xu >