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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4820C0218A for ; Thu, 30 Jan 2025 16:10:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 514B42802AE; Thu, 30 Jan 2025 11:10:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C51E2802AD; Thu, 30 Jan 2025 11:10:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 365FC2802AE; Thu, 30 Jan 2025 11:10:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E9A942802AD for ; Thu, 30 Jan 2025 11:10:46 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D1236C025A for ; Thu, 30 Jan 2025 16:10:36 +0000 (UTC) X-FDA: 83064606114.21.8B6607D Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by imf02.hostedemail.com (Postfix) with ESMTP id A03368001E for ; Thu, 30 Jan 2025 16:10:34 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=ffwll.ch header.s=google header.b=eKyiXl7E; spf=none (imf02.hostedemail.com: domain of simona.vetter@ffwll.ch has no SPF policy when checking 209.85.128.52) smtp.mailfrom=simona.vetter@ffwll.ch; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738253434; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+aR4Ll0dxJFmtTXN5GjVVUyw5AIaU7JwbYHSEFoNZYE=; b=oObVBWBhz+bUBoYXg9bJIyohfa0mj+ZTRMmziRWaPVr/Y0/c2oL3WseGQY1F1MoZHMwIgM 9+n8yikMWkZWRemJpcSdwFLhrpeDLUfcAy4/Q4fwIOCUyw+6DC261Vd4nA8NqW/sigJNrq TdPFz2zddurq8zsRSZ3M9fuTM5b66KA= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=ffwll.ch header.s=google header.b=eKyiXl7E; spf=none (imf02.hostedemail.com: domain of simona.vetter@ffwll.ch has no SPF policy when checking 209.85.128.52) smtp.mailfrom=simona.vetter@ffwll.ch; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738253434; a=rsa-sha256; cv=none; b=1nttbLWqbVS62IydZBBLNMXqm7kzb6/MLn5DaOrIFj45irohc+UnNDsMSBiopBblui4hNm Zb99EnLqP3M7+Ni+q7Q4UJyH9L+zV8zOWMH0TBUQKDtnWPw/Vt7AMHQwNo0rtqXNEjRQjX wFDejQ1XFwgrhP5BtSTrguZYQleP/TE= Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-436281c8a38so7472635e9.3 for ; Thu, 30 Jan 2025 08:10:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1738253433; x=1738858233; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=+aR4Ll0dxJFmtTXN5GjVVUyw5AIaU7JwbYHSEFoNZYE=; b=eKyiXl7EI1c8l+gYvCKQDWnZbPVsL30sv1Mrluret3T+MT1dsJG5gt+MtVnYXm8yeg tthwEKuqr6A3zNh8EoWzLkG7HKmTruabp1AftFUeZrvxFhPbSlALpw47ynt5Q3vk8iJL M313Dk9bPmpkzQxijtffEbygDER8b9QyHbobc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738253433; x=1738858233; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+aR4Ll0dxJFmtTXN5GjVVUyw5AIaU7JwbYHSEFoNZYE=; b=UnIXpv354yBmyxE4fUF8cPvcSOaFk7qFoj7r54ZBYwvqfY7YD1cty+5YvdO5NMJ2i/ N3Y3O4QAgayGooPe4jI4nREJlLcwAUXPdvz4bAJ0TjilVeIZ3plcipZevTQem98cPQEO 1tg8tQuiJ5qOPFg2nhYKy79Z7MvOa7bHMUO9S2LeO+2678Ze49dn3IyvHu6kJLO9LHyh SnyP4FKbGVl5uhgI4pI+r1SLMoeg1uV+dFrXCg3lFt8fdkW5SwDpU4V+glf7U/dYVMpY hKzMnVR18kZah3Cs0byJf9A9VlTBNG7vv068TMuUqGsTP8Q8XbyRVu5b8CQWKFe1rWzz h58w== X-Forwarded-Encrypted: i=1; AJvYcCUavVoiT0oBuXAIxELobpucg5STkr4dXd0u+WY5pp1GZZMXGw3CGkgH1Y1YtC7mZ1uMPCa1K1mEsw==@kvack.org X-Gm-Message-State: AOJu0Yxr/GZtHbBw4bVKHngHE9Lcr1DNN4pQjUMDLjtqdZLNLw9MVPZF PmpvM+hnlqH2v0mlWmvpTmaDC6oH9fg+rCUuRH6ulGDSvEef/dk2BblYXOL0+LY= X-Gm-Gg: ASbGncuYCjIyjT6YqC/I97amGK66mi+9v9y/C7xEbL5A5b0spyDWj7TA9SX30IyWRgx /NX7nXzgyLVvtKAC33KTn+YGV3bwuoY9Wgo27K5W425btWlWZ5bZ+c5nzZHug81Y0JgIxNsn8lX LqhNSPbQdrd2x4eiUkULkydn8Idem+QcPiTT2nX5pxD3bXcxnQMpFvBJnMZiwbcp6icsppHpmkT qdZ91Uvwk9El8stQBtTKDyy/vlmKz+6zPjbrxo1reE1+SnI7y6qHsbjHVqjpe9OsHLIBqxBO0sc rxx5YhgTS6K4h0LpbsZr71FX0sw= X-Google-Smtp-Source: AGHT+IHVd4DfU6AaL1PQgWpWv09mvfBE8UJUdITJOwxWpPybeOC1smy7UyEu+/Ad7rIxi3xBtlBrvg== X-Received: by 2002:a05:600c:5486:b0:433:c76d:d57e with SMTP id 5b1f17b1804b1-438dc3a40d3mr81383795e9.5.1738253432989; Thu, 30 Jan 2025 08:10:32 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:5485:d4b2:c087:b497]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438dcc1315esm62266005e9.6.2025.01.30.08.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jan 2025 08:10:32 -0800 (PST) Date: Thu, 30 Jan 2025 17:10:30 +0100 From: Simona Vetter To: Jason Gunthorpe Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, nouveau@lists.freedesktop.org, Andrew Morton , =?iso-8859-1?B?Suly9G1l?= Glisse , Jonathan Corbet , Alex Shi , Yanteng Si , Karol Herbst , Lyude Paul , Danilo Krummrich , David Airlie , Simona Vetter , "Liam R. Howlett" , Lorenzo Stoakes , Vlastimil Babka , Jann Horn , Pasha Tatashin , Peter Xu , Alistair Popple Subject: Re: [PATCH v1 08/12] mm/rmap: handle device-exclusive entries correctly in try_to_unmap_one() Message-ID: Mail-Followup-To: Jason Gunthorpe , David Hildenbrand , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, nouveau@lists.freedesktop.org, Andrew Morton , =?iso-8859-1?B?Suly9G1l?= Glisse , Jonathan Corbet , Alex Shi , Yanteng Si , Karol Herbst , Lyude Paul , Danilo Krummrich , David Airlie , Simona Vetter , "Liam R. Howlett" , Lorenzo Stoakes , Vlastimil Babka , Jann Horn , Pasha Tatashin , Peter Xu , Alistair Popple References: <20250129115411.2077152-1-david@redhat.com> <20250129115411.2077152-9-david@redhat.com> <59feb709-dadc-4d19-857e-49320cca3d98@redhat.com> <20250130140832.GM5556@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250130140832.GM5556@nvidia.com> X-Operating-System: Linux phenom 6.12.11-amd64 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A03368001E X-Stat-Signature: sz8cnj44eozwdcrkm3xit1x9kphqgisk X-Rspam-User: X-HE-Tag: 1738253434-23153 X-HE-Meta: U2FsdGVkX1/kfKWKpB2acmqkQ4nxYJOj2Fg5OvihxSLzsb27tHShXJQQWthGl80+tBZxnqK8jjQQt8lIl83QNjBVARoBmwBLwsHIWzAdJ+LPaI+RgGdwQFmSpgpFQM2hhkNKyih4fDNCao8UlKTvEWgvJmRHD3A8elRBBfMb/1pexqjktCjRti3sdy8IiSzq89z5fAnSH71nWiCvD4u4R3bb8wUqRcOsxU8nv+Xo7R+VuVoKYbzgN4nuVc6YEeVefH5zUffeRzzdlkvqIX0dTAI9vR800mH9Upf/VuxejtbsFK6cvHiQsofD8OE9nNCTnb92HNKNtgwf+nhB+p/RpQjtf75eBoysciOeYvRwdGYrGd2E9yGKIke8k5/AOAQm1dE123SIdi+WiM0VuL5VqCK5gj2YgwZuqtQV3XNWUlQbkh88OGt+1vslWPcUA9xHiFOcIAX4Ma1z4Ly6ADsNhKtXySUzBdkD4BkzVe60nLSsY+Y9LF5mzWXhCKJvMI6Eaca75BOQvO0jshK+mLbK3awKd7tO8jF6xKknS34Jtmx0eN/T6BsS2Ye7LjPQjc3ToIEvvVa7YO3zd0xDbpWPfTm3KBPd7qMpg5kmKTcDZAiC5JIAiQO2K3SN7gCLOV1a8654cfPq+dmawKzX58CP2nXI7Kdkt08O+V219C09a+5lGlTZVeTnRsPjvXnMv9F4InzaeSYhVl+iYbn5wkM4xeiUV464IrYUJQkXpNJfIKHAPwU4WN6OIINKLu009mHXFfmXFxxah4FYanW6TmGIceI4NbT6pxxiKbsQ1c2qlXVd9nlVqgn7+Pw8yG7utXrEipYiclsnLMrJmi8a8kDIOIjJMe2djweb3dGx2G6Pe0kkne6aNYSkPGUSTRhkcRPVfBgDMOOxbRR8eB7jyQjG8GdYLvboeWTzJ8o207MoMvZNZtJ66hnqXkux+fKic8rdE9GYfvnRqvVnTf1J/ok yPgihXTu L57mw7UVgwPRvpG7hPAoBVK1Mat+WQwHegWNKgdKzgoRu/jlH63HOm4j9+rrI8x+HJPm+YwicxASz1r1fMcPd16uGMebhva6hpYusBBuxK6cfNvTGHsr6/VfJlS1iYAlM7LNhI8TOUqnENnCoIMU4qo6x7IzJRqONFqXMdBAqAA5CyMeEmNfZfAIPxdkwyKu4Qem+JJCTjA6pzkYgD5VrEiXkymDB3X1YMSvB+7SYekRUmxn/l5TDd3YHZkyZ7+vGguVUVnWuICT/qDmJiYG3eYHS75OLGKGDpbbkxuhJzM+OEOrUzsiwlkfAl41XJEgk5QM+CdXPUWmptjUeWdDYtf4clw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.011682, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Jan 30, 2025 at 10:08:32AM -0400, Jason Gunthorpe wrote: > On Thu, Jan 30, 2025 at 02:06:12PM +0100, Simona Vetter wrote: > > On Thu, Jan 30, 2025 at 12:08:42PM +0100, David Hildenbrand wrote: > > > On 30.01.25 11:10, Simona Vetter wrote: > > > > On Wed, Jan 29, 2025 at 12:54:06PM +0100, David Hildenbrand wrote: > > > > > Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") > > > > > we can return with a device-exclusive entry from page_vma_mapped_walk(). > > > > > > > > > > try_to_unmap_one() is not prepared for that, so teach it about these > > > > > non-present nonswap PTEs. > > > > > > > > > > Before that, could we also have triggered this case with device-private > > > > > entries? Unlikely. > > > > > > > > Just quick comment on this, I'm still pondering all the other aspects. > > > > > > > > device-private memory is entirely owned by the driver, the core mm isn't > > > > supposed to touch these beyond migrating it back to system memory in > > > > do_swap_page. Plus using rmap when the driver asks for invalidating > > > > mappings as needed. > > > > > > > > So no lru, thp, migration or anything initiated by core mm should ever > > > > happen on these device private pages. If it does, it'd be a bug. > > > > > > I was not 100% sure about HWPoison handling, that's why I added that > > > comment. In other regards I agree: reclaim etc. does not apply. > > > > So maybe I'm just entirely lost, but unless you have a coherent > > interconnect I don't think hwpoisin should get involved with device > > private memory? And for a coherent interconnect it's just device memory, > > which isn't treated very special. > > I'm not sure it is meaningful, but in principle a driver could keep > track of the poisoned private memory using that struct page > bit. Perhaps in that sense it is more of a driver private flag than > something the core MM would touch. > > If you have a coherent interconnect then you should not be using > device private. Yes on both, that's what I meant. -Sima -- Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch