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 1FE76C433FE for ; Tue, 8 Nov 2022 09:40:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A61828E0001; Tue, 8 Nov 2022 04:40:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A123C6B0073; Tue, 8 Nov 2022 04:40:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B23C8E0001; Tue, 8 Nov 2022 04:40:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7A4116B0071 for ; Tue, 8 Nov 2022 04:40:29 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 14020AB81E for ; Tue, 8 Nov 2022 09:40:29 +0000 (UTC) X-FDA: 80109779778.30.6FD4B92 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id B50D71A0004 for ; Tue, 8 Nov 2022 09:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667900428; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lW38e6pXJ1acSlo/JcbNSc5AQG/ffLUgHR8IViSMTS4=; b=UA8+oXJC+IW9OLSaXL9eq6ACo1uKgTXMGDp8u7oC1Eb0QB22A1MviLU6Azrm3pS2KZC++b W7rYPAu3vFu2/B4ilK3kQ08oBrOwkpk6r3vu40vEjTj4jkcJ5EaV/Pzryqx+XXCcDMVBZv 7jvykvQekgcak06736A8bjvr1uY+kdo= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-351-QhVBl0YEMgiSm21i9Tmd9w-1; Tue, 08 Nov 2022 04:40:26 -0500 X-MC-Unique: QhVBl0YEMgiSm21i9Tmd9w-1 Received: by mail-wr1-f70.google.com with SMTP id u20-20020adfc654000000b0022cc05e9119so3779587wrg.16 for ; Tue, 08 Nov 2022 01:40:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lW38e6pXJ1acSlo/JcbNSc5AQG/ffLUgHR8IViSMTS4=; b=SMTE3a+8xvNQPaq6/3LffFP9BVPub4sBTbRt89lpfbBiXJW3ezDGAIYIH0x/k8w0nN S6qOp9zhgnMIR/Bz4WkZt2Xb5Vfi72cqdmpC0VGu1cA9c6GlLnnsItGuGmeHvv7M59q6 SD6dFs6/oV70b7BmHnO6NOI5E6y0LVtGAxKzvra+0tZ3oV3jon8X9JACr9i/jqAeMCRT F7eWdb60dKopmK4aosq+jEKk2YpjNMsj3bYyEyDTOBU2f9s9iERLxDrD6c5lU2d2mgry 3pvwuT7BIbSLBiJb6wly6+wY7NOOYFgfC5AIuIOLRshBuRMYRphN+BVJpl/2DFl8Zf8R vGEQ== X-Gm-Message-State: ACrzQf2w++x8g2NT+yS3BF1j0CyLP3R1vuaOO9qCST71MPLYj6bizWdf FMNMfmWnoizoSbCBbHz2kjzStMSq/pvpjJtAZk9bMs+rHKYFb3X5Ub8Wy6qwP5iowhkPIpiMgmr Oc+iUdJ9hXaI= X-Received: by 2002:a05:600c:54ca:b0:3cf:8e5d:7146 with SMTP id iw10-20020a05600c54ca00b003cf8e5d7146mr18675275wmb.191.1667900425631; Tue, 08 Nov 2022 01:40:25 -0800 (PST) X-Google-Smtp-Source: AMsMyM5cH9tWJ/7f+h1bsvSFgTQP1m4PENc1Ye2cP0NqhUl7fQavJfxFFKESh5AiG6/w6GmkhSUyjQ== X-Received: by 2002:a05:600c:54ca:b0:3cf:8e5d:7146 with SMTP id iw10-20020a05600c54ca00b003cf8e5d7146mr18675241wmb.191.1667900425279; Tue, 08 Nov 2022 01:40:25 -0800 (PST) Received: from ?IPV6:2003:cb:c708:db00:6510:da8d:df40:abbb? (p200300cbc708db006510da8ddf40abbb.dip0.t-ipconnect.de. [2003:cb:c708:db00:6510:da8d:df40:abbb]) by smtp.gmail.com with ESMTPSA id bu12-20020a056000078c00b0023655e51c33sm10027356wrb.4.2022.11.08.01.40.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Nov 2022 01:40:24 -0800 (PST) Message-ID: <040542e7-7d1c-4f25-b1ed-459f3c165283@redhat.com> Date: Tue, 8 Nov 2022 10:40:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 To: Tomasz Figa , Hans Verkuil , Marek Szyprowski Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, linux-kselftest@vger.kernel.org, Linus Torvalds , Andrew Morton , Jason Gunthorpe , John Hubbard , Peter Xu , Greg Kroah-Hartman , Andrea Arcangeli , Hugh Dickins , Nadav Amit , Vlastimil Babka , Matthew Wilcox , Mike Kravetz , Muchun Song , Lucas Stach , David Airlie , Oded Gabbay , Arnd Bergmann , Mauro Carvalho Chehab References: <20221107161740.144456-1-david@redhat.com> <20221107161740.144456-17-david@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH RFC 16/19] mm/frame-vector: remove FOLL_FORCE usage In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UA8+oXJC; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667900428; a=rsa-sha256; cv=none; b=hIDS7sp1HtWcNJXH7+GNNBB40HsCMBJqTI7fcH5UPOpy/2olX3+9J9Pp3EvUpjvnTNOB7W k2nPEzPWW6rhn52VwBfAlj9dVG2XoUsoYRAep58TZZ8P06SpMf87yYg1g9MvTUc9f4i0p1 8GVWRF6vX8QVx/t2STuGR4McdEm7OOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667900428; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lW38e6pXJ1acSlo/JcbNSc5AQG/ffLUgHR8IViSMTS4=; b=PUOTRHcoDzdwRb9UmThPaTYkV14bc77US8bOqOycOVjb7VtXsLqtNUF/s4AzXscWWCyks2 rYun25v9WeOelOyt98c7EnVhTtLnan0KRKbHesxerO9NBYe0pr/H5SPOTOlXyDYi/4NBzv MaAkc9uzzZV86izXRR4smrHQAXK/aQc= X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UA8+oXJC; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B50D71A0004 X-Stat-Signature: obdhor8c44ceffpiikk1egymstna9cj1 X-HE-Tag: 1667900428-250311 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 08.11.22 05:45, Tomasz Figa wrote: > Hi David, Hi Tomasz, thanks for looking into this! > > On Tue, Nov 8, 2022 at 1:19 AM David Hildenbrand wrote: >> >> FOLL_FORCE is really only for debugger access. According to commit >> 707947247e95 ("media: videobuf2-vmalloc: get_userptr: buffers are always >> writable"), the pinned pages are always writable. > As reference, the cover letter of the series: https://lkml.kernel.org/r/20221107161740.144456-1-david@redhat.com > Actually that patch is only a workaround to temporarily disable > support for read-only pages as they seemed to suffer from some > corruption issues in the retrieved user pages. We expect to support > read-only pages as hardware input after. That said, FOLL_FORCE doesn't > sound like the right thing even in that case, but I don't know the > background behind it being added here in the first place. +Hans > Verkuil +Marek Szyprowski do you happen to remember anything about it? Maybe I mis-interpreted 707947247e95; re-reading it again, I am not quite sure what the actual problem is and how it relates to GUP FOLL_WRITE handling. FOLL_FORCE already was in place before 707947247e95 and should be removed. What I understood is "Just always call vb2_create_framevec() with FOLL_WRITE to always allow writing to the buffers.". If the pinned page is never written to via the obtained GUP reference: * FOLL_WRITE should not be set * FOLL_FORCE should not be set * We should not dirty the page when unpinning If the pinned page may be written to via the obtained GUP reference: * FOLL_WRITE should be set * FOLL_FORCE should not be set * We should dirty the page when unpinning If the function is called for both, we should think about doing it conditional based on a "write" variable, like pre-707947247e95 did. @Hans, any insight? -- Thanks, David / dhildenb