Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp479878lqp; Wed, 22 May 2024 09:56:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYlMfSUKbIm1Xe0i0rhvDns7yoA2yDmoY2uD9nyzN7VV1fjW/i5gMhG1iajCcZL4/OM/f6YzaGUv4lAjeXf2xnKzJU2w3RRD4bRt13RQ== X-Google-Smtp-Source: AGHT+IHxz2nqIIHrjlK7PFQDYL0bjtAuuQhZQQlMJESshiSTM1UDgnXfdOPbd5vV9oDAYRN4Oh6X X-Received: by 2002:a5d:4201:0:b0:354:c934:efa1 with SMTP id ffacd0b85a97d-354d8dab2damr1671305f8f.56.1716397005127; Wed, 22 May 2024 09:56:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716397005; cv=pass; d=google.com; s=arc-20160816; b=tH973JoP2LPVlQ2ntQVOQbRlEpbXvfS/Jaf4YHhjDkhMxDpx3QKoCFpgMkQphgyBLU WRyaQw6aF2RTKJ6/V7iCXnwGJvD4dfMrvGE/xdeRC2c0nRlckC6nP64LfJm26KcFkgVY K1XE0wav14mn0AyNiBg+FYrnv4VR85YXUBd6hRWfAsaKTIZ8iK/gzXZVlBLexLH1xnvE kqQhKRuyAYL5ML5FEnMsE4loEtUHXaHb/dzF3hhuLuiF3dP/jiLIltyuCoxUh9qZOAz+ z2SwVsDvz2p9I+zSoJr3i4aMnPln2/dIYIn7Zxv2MUvJFj4gGchUmQB7pPVJTXbRxRGs TrlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=v4VWbigBV97aeZyxhifeEI6VQ++Df9sfCivB+cI7pOU=; fh=XjTTqU4sjKAxZMrUZv6bnMxogAWgCyFF45ZX3OD2+/0=; b=F5XwZMmnH99wl4nuLrBxrG2650Oie3EJPJuUHPUsBg3xLyHMAp/nE5rknyb/AWnuNg O9sP1m5XV4wWHrxgswSv8GeoYobBGVQKxISzhLCy3wggBDZkMgwUgmGDJ4hfeDEgM5Nl 9nRJvC/oS8C+VAbeqW4i9rLTuxULtchh0LwajI/P75vqFlyz25IEpwSBpDLjACtNKwR3 SHnrIfAbfg2GV7neSL10e8/T53O3/jEN4vIBu0TUCgc8D3W00sVz21UhBaaihxxq3aFW 7LI8nEztOvi7cfsrNNAsUZVTLxpk4VpkmrTdBIs9dhQNP0r/56eTb7d5eaiADaTCtXz5 FTdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Hgc0UHia; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-186526-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186526-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17945eeasi1483206766b.92.2024.05.22.09.56.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 09:56:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186526-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Hgc0UHia; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-186526-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186526-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D084C1F22438 for ; Wed, 22 May 2024 16:56:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A24F31420D1; Wed, 22 May 2024 16:56:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="Hgc0UHia" Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A3AE249F9 for ; Wed, 22 May 2024 16:56:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396994; cv=none; b=reFi5ZUfKp983C8JtzGI8Kc1E4LpEg8/J7nFeljHlXIcsCtPa2N5RxyqkJG+SjHTn8Yv/AynGOCDwIpOQ0rS1cNEP4sDtf+RBk/isb5KNWKvIji5dH79XDRdJbLsZ2NlR5jDVVU9OLVG6okBCm/B/Yb5olZULm/iGy+W/Z3c0v4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396994; c=relaxed/simple; bh=K/QFqvmIUmvv+6I66+VxZaEmsXlY7Dd6DLzcMLWByuk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BwKNv0DENryazsxOWGswqdA40XLvq7feStBsAaAMbHK2GIawOl33kGWEI+G12owfGz8xhvWKLkulSubUrsbXdD4x1EGmnfq7gz/Rk9KWmRnr27v/mfvPWmuo1L2cupQhZRD1VyKEg3CIydU4keKMuDZ/YXl/ak2QucbLtZgccH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=Hgc0UHia; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5206a5854adso5978852e87.0 for ; Wed, 22 May 2024 09:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1716396991; x=1717001791; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=v4VWbigBV97aeZyxhifeEI6VQ++Df9sfCivB+cI7pOU=; b=Hgc0UHia+N1oUrRYGADRbxr1BUmABZenh3NNQl6bfkQbz77HekguN9TBpx6z9FxdnI L0Q17QBAtnQd1UQHTM7vaAoLfOEsCBFx5A3mDFJ18EQyrk6YmOomyKYmyGLWdVbWwdmN xyUM91E4X4avohwVmMXbLmjCWs14HSGbumACoK4Lvbqdyg3GQcnZFooZcWObqngebbWZ zo+VvVJJBqKbGPUWQY5k7hOIDpb3oewk3k+uZ7xrJNZeg7JtOIm+8RRC5f8Aqn3TKoCG BwfgDdgJmVxl454mqdJuHJEJQHc9ZQ/q1stDuDyvPW6h2Od5t1rcbvgnHpzDpcWtAmDz iCaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716396991; x=1717001791; 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=v4VWbigBV97aeZyxhifeEI6VQ++Df9sfCivB+cI7pOU=; b=FwNHZIx4I2k35acC7/np7xuewU2Ehx5dmKY48jFZhxn7AA2ITjmscubYEhRqi7Lwvi jGAeK8pxoYHQIGRbGTF7CLItfwO6mLdHSFpwB0asIjBaYkRrQUSzQ9JW/tA6y3Dz7lSW BzZnFHY2T18dnEmjqC+Q8k5YLq1ZWU9dOsGgyD8gg43LasQGj2EbdXD1VoQarRQc++lx MuPTVTYOuOUbmYIWE0rNNYfYgxVQsMv70xiocptvZ4aJzjMMnbo47sqECrxel2FEw5N/ oICwL2u+K3UUubIwJzcEc/Z+MKerYEc9dOl7BNSi/3eYlRDdJaxuMPMemZmdjWupbm5l 5ETg== X-Forwarded-Encrypted: i=1; AJvYcCVK14pEERNiowC3rzeFcVV6j5bh9TqDJ7CwgX+GUsYHYbbTNa5gjOGIw+6oXxcMNbOLjtSoP6wCkkoer3mo3Ki//V9zdP884Pfxoah6 X-Gm-Message-State: AOJu0YzfUn99qIWdOii3gKSEFjs+eM6elQml+r/vVXazXI8IK7D7rLkN veD9oDXq+KxWxMwv1g1vbiXW+O/jDE0zMo5vtlUNM6aIqAEf955OP8CztfnWAKM= X-Received: by 2002:ac2:5442:0:b0:522:2fa0:c3f5 with SMTP id 2adb3069b0e04-526bfc02eb2mr1542529e87.62.1716396991348; Wed, 22 May 2024 09:56:31 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17894d40sm1790774566b.75.2024.05.22.09.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 09:56:30 -0700 (PDT) Date: Wed, 22 May 2024 18:56:29 +0200 From: Andrew Jones To: Yan Zhao Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, alex.williamson@redhat.com, kevin.tian@intel.com, jgg@nvidia.com, yishaih@nvidia.com, shameerali.kolothum.thodi@huawei.com Subject: Re: [PATCH] vfio/pci: take mmap write lock for io_remap_pfn_range Message-ID: <20240522-b1ef260c9d6944362c14c246@orel> References: <20230508125842.28193-1-yan.y.zhao@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230508125842.28193-1-yan.y.zhao@intel.com> On Mon, May 08, 2023 at 08:58:42PM GMT, Yan Zhao wrote: > In VFIO type1, vaddr_get_pfns() will try fault in MMIO PFNs after > pin_user_pages_remote() returns -EFAULT. > > follow_fault_pfn > fixup_user_fault > handle_mm_fault > handle_mm_fault > do_fault > do_shared_fault > do_fault > __do_fault > vfio_pci_mmap_fault > io_remap_pfn_range > remap_pfn_range > track_pfn_remap > vm_flags_set ==> mmap_assert_write_locked(vma->vm_mm) > remap_pfn_range_notrack > vm_flags_set ==> mmap_assert_write_locked(vma->vm_mm) > > As io_remap_pfn_range() will call vm_flags_set() to update vm_flags [1], > holding of mmap write lock is required. > So, update vfio_pci_mmap_fault() to drop mmap read lock and take mmap > write lock. > > [1] https://lkml.kernel.org/r/20230126193752.297968-3-surenb@google.com > commit bc292ab00f6c ("mm: introduce vma->vm_flags wrapper functions") > commit 1c71222e5f23 > ("mm: replace vma->vm_flags direct modifications with modifier calls") > With linux-next I started noticing traces similar to the above without lockdep, since it has ba168b52bf8e ("mm: use rwsem assertion macros for mmap_lock"). Were there any follow ups to this? Sorry if my quick searching missed it. Thanks, drew