From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64262C433DB for ; Mon, 1 Feb 2021 19:33:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EADBE64E50 for ; Mon, 1 Feb 2021 19:33:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EADBE64E50 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 39B526B0070; Mon, 1 Feb 2021 14:33:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 34CD86B0071; Mon, 1 Feb 2021 14:33:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23C6C6B0072; Mon, 1 Feb 2021 14:33:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 0AA856B0070 for ; Mon, 1 Feb 2021 14:33:42 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C35E5180AD822 for ; Mon, 1 Feb 2021 19:33:41 +0000 (UTC) X-FDA: 77770698642.02.week34_400aee6275c4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 998EB10097AA2 for ; Mon, 1 Feb 2021 19:33:41 +0000 (UTC) X-HE-Tag: week34_400aee6275c4 X-Filterd-Recvd-Size: 6340 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Mon, 1 Feb 2021 19:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612208020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Cts+A+BD4EzHAWhJKCdYjKO/m6gZhIEKA3PVKIyBlzc=; b=hM86VxNtbpmQCMWCDNVj+KSxstlQHG9B45uqRcqfvrs11JRz1pbhlTBDqW+RCYsoaHKMuI 46Q2UnOvzvcb/b/fj+g02/vDgKhqbMTki/NJXWZjFsaRJ/AbUkbTnZ3Gdi+HPprKQaaJml jFi9pN9seRLdui8ht8l/OvuieXCiNCE= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-422-kuGDpcnNNuW3lrC165byKQ-1; Mon, 01 Feb 2021 14:33:38 -0500 X-MC-Unique: kuGDpcnNNuW3lrC165byKQ-1 Received: by mail-qt1-f200.google.com with SMTP id f5so11387585qtf.15 for ; Mon, 01 Feb 2021 11:33:38 -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; bh=Cts+A+BD4EzHAWhJKCdYjKO/m6gZhIEKA3PVKIyBlzc=; b=DrMSsiGKRqW9BQKRJ2OKEwsBlHD8WL3D54l2zFr8eDO9OBckmQylFCsvF0n1pTLaj1 LZoXziiT/miVn4DW2whPe97eeb17IZEQ0hTTJYRr5z9j86bI02tNRg0zd32m6X6Hq3Ta JTKUont1c6x7jWkx5XB03n9MIfGHRzE+TxXUJlkLfxg1djO/wus7EzJkBHdxvSUa+vLD 52wjwN/vpd7A6MQ0hXqCdrcBlCpP6YLJRvA5DT+Pgyjpj/GOpf+UlSkk7vbl5VIrJvHs +cQiiETLUfmuXqukqcUxakRo4L3ZBWOzi+mXfPtFhAVgLcDAdULkH6+UMVeBLuPN8vg1 lW9g== X-Gm-Message-State: AOAM5333gDKfmofdPFz1DBtgph+cfgCoOcscNk3TADxoyEGpB9LdFCVu n3yXTi8Zmd0RKQFv/43nrSaRkZ9FOC7B71VwY6tdfcrW1oZmucirhixA/MB9wAbYF92de62oLoo k6RzDguj/+Yk= X-Received: by 2002:ac8:12cd:: with SMTP id b13mr16210985qtj.359.1612208018162; Mon, 01 Feb 2021 11:33:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfTW58+3dbzuXbKBkuhRaH+LVveYkhpMgEMODvnwa7Cja8XS427D9KscJhY7tm0nNom/FFcA== X-Received: by 2002:ac8:12cd:: with SMTP id b13mr16210946qtj.359.1612208017944; Mon, 01 Feb 2021 11:33:37 -0800 (PST) Received: from xz-x1 ([142.126.83.202]) by smtp.gmail.com with ESMTPSA id d3sm12440243qkg.120.2021.02.01.11.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 11:33:37 -0800 (PST) Date: Mon, 1 Feb 2021 14:33:34 -0500 From: Peter Xu To: Axel Rasmussen Cc: Alexander Viro , Alexey Dobriyan , Andrea Arcangeli , Andrew Morton , Anshuman Khandual , Catalin Marinas , Chinwen Chang , Huang Ying , Ingo Molnar , Jann Horn , Jerome Glisse , Lokesh Gidra , "Matthew Wilcox (Oracle)" , Michael Ellerman , Michal =?utf-8?Q?Koutn=C3=BD?= , Michel Lespinasse , Mike Kravetz , Mike Rapoport , Nicholas Piggin , Shaohua Li , Shawn Anastasio , Steven Rostedt , Steven Price , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Adam Ruprecht , Cannon Matthews , "Dr . David Alan Gilbert" , David Rientjes , Oliver Upton Subject: Re: [PATCH v3 9/9] userfaultfd/selftests: add test exercising minor fault handling Message-ID: <20210201193334.GH260413@xz-x1> References: <20210128224819.2651899-1-axelrasmussen@google.com> <20210128224819.2651899-10-axelrasmussen@google.com> MIME-Version: 1.0 In-Reply-To: <20210128224819.2651899-10-axelrasmussen@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jan 28, 2021 at 02:48:19PM -0800, Axel Rasmussen wrote: > Fix a dormant bug in userfaultfd_events_test(), where we did > `return faulting_process(0)` instead of `exit(faulting_process(0))`. > This caused the forked process to keep running, trying to execute any > further test cases after the events test in parallel with the "real" > process. > > Add a simple test case which exercises minor faults. In short, it does > the following: > > 1. "Sets up" an area (area_dst) and a second shared mapping to the same > underlying pages (area_dst_alias). > > 2. Register one of these areas with userfaultfd, in minor fault mode. > > 3. Start a second thread to handle any minor faults. > > 4. Populate the underlying pages with the non-UFFD-registered side of > the mapping. Basically, memset() each page with some arbitrary > contents. > > 5. Then, using the UFFD-registered mapping, read all of the page > contents, asserting that the contents match expectations (we expect > the minor fault handling thread can modify the page contents before > resolving the fault). > > The minor fault handling thread, upon receiving an event, flips all the > bits (~) in that page, just to prove that it can modify it in some > arbitrary way. Then it issues a UFFDIO_CONTINUE ioctl, to setup the > mapping and resolve the fault. The reading thread should wake up and see > this modification. > > Currently the minor fault test is only enabled in hugetlb_shared mode, > as this is the only configuration the kernel feature supports. > > Signed-off-by: Axel Rasmussen Reviewed-by: Peter Xu -- Peter Xu