Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp189160rwo; Tue, 1 Aug 2023 15:19:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlEaII/fR87o2Iin5pa3Ht1oDyCzcj8UDfIbztWmsn4pIpHN6O388wWvG0lFfeL/UabIbFwJ X-Received: by 2002:a17:906:74ca:b0:96b:e93:3aa8 with SMTP id z10-20020a17090674ca00b0096b0e933aa8mr3654130ejl.21.1690928396750; Tue, 01 Aug 2023 15:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690928396; cv=none; d=google.com; s=arc-20160816; b=onF/Ur7uQsWYUOJAcimSFd04qBH/imy9xWl6TVui3LRCSngP/A4ghXi3oUY48nqh8G O1AGGEzq4qZ1BupilZJagTbzuoRaE+p/qPq/wWl3B6Ha4G+e4NRzsClZsb1eCRzBhewr Xk9pWg909huqMUWJPRocF6CeXuKSZGWY9Nkmwu5B4Uo5TvmaybnxSdzwkgIebwlSUwyW wQtmYviVmJEG6z3EOjbJKDd7mwXW9iR1lqCHHuhs0LdfkyYTxb0QefvqzGplqtUosutC TX7DieDTr4Mie/zBraMeBtkDm7o2khTZQdZMnXzRbbnX712k18KAULn8moxwqQr4zdC5 3r7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=WpNjvdyqURVpJ2zUI1mEAiHbIdULXSwVnHK8BVQhnhU=; fh=w+60nX3ZvnR7eowsAk6bkZJuudootphkquUbsDZOA7A=; b=PuUz8yvIOye86Dn7sKBgdKQJVUkF9CyEfCu3cjDRTrn+kqkd63JQc4VjaAwoe64xbH AUm06slwaSr6A76E1ImCUA50l3aAX5dMT5h42ImbOunfpV/Bdv2WtQ1rIiLF7z+XEvU9 SerHGTnHDz7zg0tklgWRahYBsjy4SqdR/I3uIb4QgP7o62ivFHnh93QIUt3cHMUxJ+RE EfEo6DF760YhDVoPL7clu7lfLrIToxpdXPcUAsmL4cOjlxm+0NRAPHHRjx2tyzNejxRh isY4Px+SV5+trayyXt/KGtWKlJNBSzKR9pkNtAQnBJ56+fotcGfJ0J1estwkoCMoBbye 4DJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=4SMyoopM; 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 v25-20020a17090690d900b0099bc39cf3fdsi4626679ejw.848.2023.08.01.15.19.29; Tue, 01 Aug 2023 15:19:56 -0700 (PDT) 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=20221208 header.b=4SMyoopM; 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 S232180AbjHAWOM (ORCPT + 99 others); Tue, 1 Aug 2023 18:14:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbjHAWOL (ORCPT ); Tue, 1 Aug 2023 18:14:11 -0400 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF8871BC3 for ; Tue, 1 Aug 2023 15:14:09 -0700 (PDT) Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6bcaa6d5e2cso1796030a34.3 for ; Tue, 01 Aug 2023 15:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690928049; x=1691532849; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WpNjvdyqURVpJ2zUI1mEAiHbIdULXSwVnHK8BVQhnhU=; b=4SMyoopMgqoEw0/F6B5MkJennZdxMY2EtGO2rfkv6UnELFUnWA5Vg6jl+P/m7tKwvd 2+FP33M7rwHe3mrVYq3RXK/tuUJ4kBPz76+GmvDDDo+Oe+d/qnTHjlMF1MxSKIEwRGMo F00Hf+vxcbas/ajrgyfqBaPIlHeytFhZ5INR+Ax31S8hxpYRYFceOs32LgzCRI54TUEW opSH1X7BJMeMX6cEQdUH9OqNvAJJ056NV2bdOpbnWGB0UWKih10N/g6Ozg9c0L7+T/8d b4VvZRxjwLWgChBZ8uXy4ndGXEgOZOLFqe9ZNKlqHSZkYh3JtvscUZpj4pUPHWLMIVBT tUDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690928049; x=1691532849; h=content-transfer-encoding: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=WpNjvdyqURVpJ2zUI1mEAiHbIdULXSwVnHK8BVQhnhU=; b=YXAYZxhQb8vYlS6SAEdqp5tlSAeHX3onAYxwdbheVlELb+4SZD5ZICpDrMUvmVZIGJ uVoXQ7S+xR70XVMjXIXdXcA1YciwA4AjE0j8Zi14ewamG39RyY4TTY5VtwUuSDxfs47u v1afxLbnohoPlRS8bVU0W8HctPpamL3/vx9eRV+uBqKON4ezUOd8FqHYqgIy0tDDB/Oh n1HGFPYkskradazq9k8V/xdqivzVNZ98ryk9SJqcDMMDc53mWtkjoT1eufUQ7qvVHVro ZtglbHmgnwm2c2kxIqGeWlkWrTcyFJlSkdFI98/GleZaQdMmjoGt6RPxwawWa4/9eBy9 Y+sQ== X-Gm-Message-State: ABy/qLZKRaGihcO0/k1mo1m7pOCGYbheNej1Z2atuMAF/X5zcmf2/jgG 2i4HW5MIbGWeYHAteNpKQ2GHpTcS/RY4Jl4PmWGZfg== X-Received: by 2002:a05:6830:44a:b0:6b9:1917:b4af with SMTP id d10-20020a056830044a00b006b91917b4afmr14757444otc.33.1690928048966; Tue, 01 Aug 2023 15:14:08 -0700 (PDT) MIME-Version: 1.0 References: <20230731171233.1098105-1-surenb@google.com> <20230731171233.1098105-2-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 1 Aug 2023 15:13:56 -0700 Message-ID: Subject: Re: [PATCH 1/6] mm: enable page walking API to lock vmas during the walk To: Peter Xu Cc: Linus Torvalds , akpm@linux-foundation.org, jannh@google.com, willy@infradead.org, liam.howlett@oracle.com, david@redhat.com, ldufour@linux.ibm.com, vbabka@suse.cz, michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, hannes@cmpxchg.org, dave@stgolabs.net, hughd@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Tue, Aug 1, 2023 at 2:46=E2=80=AFPM Suren Baghdasaryan wrote: > > On Tue, Aug 1, 2023 at 2:34=E2=80=AFPM Peter Xu wrote= : > > > > On Tue, Aug 01, 2023 at 01:28:56PM -0700, Suren Baghdasaryan wrote: > > > I have the new patchset ready but I see 3 places where we walk the > > > pages after mmap_write_lock() while *I think* we can tolerate > > > concurrent page faults (don't need to lock the vmas): > > > > > > s390_enable_sie() > > > break_ksm() > > > clear_refs_write() > > > > This one doesn't look right to be listed - tlb flushing is postponed af= ter > > pgtable lock released, so I assume the same issue can happen like fork(= ): > > where we can have race coditions to corrupt data if, e.g., thread A > > writting with a writable (unflushed) tlb, alongside with thread B CoWin= g. > > Ah, good point. > > > > > It'll indeed be nice to know whether break_ksm() can avoid that lock_vm= a > > parameter across quite a few function jumps. I don't yet see an immedia= te > > issue with this one.. No idea on s390_enable_sie(), but to make it sim= ple > > and safe I'd simply leave it with the write vma lock to match the mmap > > write lock. > > Thanks for taking a look, Peter! > > Ok, let me keep all three of them with vma locking in place to be safe > and will post v2 for further discussion. v2 posted at https://lore.kernel.org/all/20230801220733.1987762-1-surenb@go= ogle.com/ > Thanks, > Suren. > > > > > Thanks, > > > > -- > > Peter Xu > >