Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp195798rwo; Tue, 1 Aug 2023 15:27:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlEMrC/avPG56iL06wynLJgrBv9ouGzwnhiMOdi6KwPeoPfCK7KBxl2erpxz3O0jCXZbzlLO X-Received: by 2002:ac2:4f12:0:b0:4fe:17d6:af2b with SMTP id k18-20020ac24f12000000b004fe17d6af2bmr3856463lfr.42.1690928862208; Tue, 01 Aug 2023 15:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690928862; cv=none; d=google.com; s=arc-20160816; b=oO6CaWo9gc/vBHTXXx1YylYhQMa4ardPgUCyqzXcLiJzSm8s9euuFZp1NRevHu0kjO U7qyrEPPtWvT56mvNg41RgtMYXK01C7I6iUWLDBvEwPhxytHonFxDZ+bZuR8YGnwpMHr IkZDV6gHGO0KHcACc26NxYtb2hNLRfbm60qdVXwdM1FjsLZEav9KQVW4OOuFZSt98i3o 5pJMvgbOuLT2OUSnflqOj1NGgexCdcw0rGpop9vCmmaC0ZEZwoNzrfDol/m30vjHsIDL 9UO/QZs4HulViEkt5aLBzphnMNwrU/QSQApFHl0pFK9+JCSFK6mgWHSTrygbGOhVamxI dRhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nHR+gYw7cHBLdaoz+kXX0wBV31cLT+GSZK2PmYnjFDI=; fh=JmVM5Mxd4WndXONzG8HzdXnsT+/G4WN7tiEGIzz0YOU=; b=HYBYIp0HWffx+uRtpMOWHde0bjV/VkjaL6jj0TZ6hLBHT5eCDGqIWyAgd8bBzH29SH rbAs6y51wwgWt2y21O9oQvWFsxtjw0h+zrmbjcauoo6lML6BuFMNXx3dwQMKiALWRHRA +i/L+zWy0ltXzPRkvMYwX/iZJhzPhGD7rNnVhkv5wI7qfLkjzfZpdCw/KOG6P0ZR48mS bi6oTa9oBxJCuFEzcTKcYqY4I+ELoHvubq4NQ3Owfm+ndDc5shMmYl2NRQ1ii36T6yFr 4/NGQBc9YL4AoAMdtAG1L14phHnhTEhziyqBsaCAS2jqBh/Hl2BqvUyshHMBBDrnJDb6 Lq7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FYtj53Kv; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a170906115400b0098e417a0c3bsi410772eja.109.2023.08.01.15.27.17; Tue, 01 Aug 2023 15:27:42 -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=@redhat.com header.s=mimecast20190719 header.b=FYtj53Kv; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbjHAVfj (ORCPT + 99 others); Tue, 1 Aug 2023 17:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjHAVfg (ORCPT ); Tue, 1 Aug 2023 17:35:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9832C3 for ; Tue, 1 Aug 2023 14:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690925690; 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=nHR+gYw7cHBLdaoz+kXX0wBV31cLT+GSZK2PmYnjFDI=; b=FYtj53KvOv6CG02vXIxPUW0j5IoMK69VYe7G594u7DHCvRkRBjGbzmfleBQrsN2c5nohzZ VszvvzvLqFy+x7Z6aB3oZATTmMaH7CqXHP0eix1lhKbDp082JHafMYCqP33Q1ESnZRNrNI vFSeecpVtFCYVwkYizjRDPNuC7CmMDU= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-336-ucKNtDjYO8mxS05BOcmVPA-1; Tue, 01 Aug 2023 17:34:49 -0400 X-MC-Unique: ucKNtDjYO8mxS05BOcmVPA-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-40ec97d5b60so5796891cf.1 for ; Tue, 01 Aug 2023 14:34:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690925689; x=1691530489; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nHR+gYw7cHBLdaoz+kXX0wBV31cLT+GSZK2PmYnjFDI=; b=JkD+huLKUCR38U7gD04wHP8HXtWbp7LLvnyGZ7rNNFhPg32wRhQmcgL86oJrMVy4KG XdFKafH+bOgyQX3hLJZ4jVWM0uy/grBDQq87vXgniWkHnJLZGL725XId8VJmg4UYdA8A PnmpXbZVLu/bMl5Ybo8g8qvLT3SeRpAH/R3gCna3T4EAtfW3ZNifsWF04JWEeqVQ/C7J htq24VTrdUR0x7O5XnXmDizijsxrerCHAH/zor8JExbQN/4w5mfYHtk2/E+an+Qm6L+7 xiYRCcYc5FXcT/qGLnMa/WsKiFbC6BHOJ05X+yOb7Gevm/f0lDBROPS/OWA2QCSoNS2r bu2A== X-Gm-Message-State: ABy/qLZLpOAmopwYDQY+ObgOu3coWh7kLWVYb3z/1PYRubWIGUDWv3wZ 7MfqqaAz53uK9EL9pefaW5oU67ozzW1MpqLWNIdEPntuhRHqEAenbpDzleOCI5CUMacd/1i7+8V UZeSn5qXt9sL/W4f6BtFTntMv X-Received: by 2002:a05:622a:148c:b0:403:ae76:12da with SMTP id t12-20020a05622a148c00b00403ae7612damr16141367qtx.1.1690925689349; Tue, 01 Aug 2023 14:34:49 -0700 (PDT) X-Received: by 2002:a05:622a:148c:b0:403:ae76:12da with SMTP id t12-20020a05622a148c00b00403ae7612damr16141349qtx.1.1690925689073; Tue, 01 Aug 2023 14:34:49 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id bq22-20020a05622a1c1600b0040331a24f16sm4706166qtb.3.2023.08.01.14.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 14:34:48 -0700 (PDT) Date: Tue, 1 Aug 2023 17:34:43 -0400 From: Peter Xu To: Suren Baghdasaryan 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 Subject: Re: [PATCH 1/6] mm: enable page walking API to lock vmas during the walk Message-ID: References: <20230731171233.1098105-1-surenb@google.com> <20230731171233.1098105-2-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 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 after 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 CoWing. It'll indeed be nice to know whether break_ksm() can avoid that lock_vma parameter across quite a few function jumps. I don't yet see an immediate issue with this one.. No idea on s390_enable_sie(), but to make it simple and safe I'd simply leave it with the write vma lock to match the mmap write lock. Thanks, -- Peter Xu