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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 721DBC43217 for ; Tue, 8 Nov 2022 09:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:Subject:From:References:Cc:To: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wR5PFd4QTewkDWfcWX0u/eVsxMwD5ecfEsT8SlbzoYc=; b=w309xtLhDLL0P3 5OWHKCWzNCgpsJewIdBQ6V51YqUfDmg6Qp6yRZc4srQRzrZ9NEqoF2C879Utx77fhYAxSY1hV4kW3 tZDuVh+RR9AYzb6Zu7SaV70JhWMJZYJDIvjuab40bEENbRend5lYv572aA++rWu/ipU+cSGr0EPUl raZgYKs34m+BpWsF7tr4lehHwLUfsLWLguTvVGfMfSMjJgDcqRs8XRBGoZtqOr6vezoljQ+sYkTDh y/Q4VuaFuwOLxWjPshkbxIv4Q9LuOaRZhXn8Hy2GNO6cm1kRS6QqsrfWQzdyt7QjU6mzJVWCVXmX1 gOjkuSeEldAJSZyhPY5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1osL5u-004AA2-Vh; Tue, 08 Nov 2022 09:40:35 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1osL5o-004A5i-Sk for linux-arm-kernel@lists.infradead.org; Tue, 08 Nov 2022 09:40:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667900427; 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=ZNYpv5mYwz6toxe3F9rhtDkI/8OtgCl8z+jePJbDwXHpxX4sl5396j9mJDyMWXDp8bnCu3 8th8K9xFr0Y3Dgy1ZquVDAM8644e2DuR/lwyV7wZlOQlA2T12HuC/nGIrC3Zj6FNwwDunF Hw3TluVeto2wI1iBMGntc5FTDViJIt0= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-675-p8zUFXLiMMOAIRTV7fLNzw-1; Tue, 08 Nov 2022 04:40:26 -0500 X-MC-Unique: p8zUFXLiMMOAIRTV7fLNzw-1 Received: by mail-wm1-f71.google.com with SMTP id m34-20020a05600c3b2200b003cf549cb32bso9659923wms.1 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=frt0Rlyc/uhjybqSf4UkMJ1631BZ9K55KmZtk7vL/pk9tcB1ql0v7xve4VRPV0Bl0v J9Zmfmd2bYBZBFkKCGJVOVm0I0+nJL4orzBjOyhQzjTABk8Ei9Gz1ttBx6rQ/mCMs7dX AiERP93W092W/k0TwjjWCraGS87xZQE42XHCz4lN9bi4CRWuoU/fJ592Zknf7bZYwrIb iwKPeJvd9hmidg1RADrpZ4ra5VRgDE4IYLVrwYHSsYgc19Lb1zEP0brO9nOD6WNZDXRY oAgk31DCi2TuoAkWb3PD55Tor1NEUm1R6JrI4a4qzJyF6j4ogtPc2qVWKNZX+4VpiB2J k1Pg== X-Gm-Message-State: ACrzQf3xftfjKh+sJ4GCzox/XNrCcgcEWWut8+ihuUQBZfM6KN7YLND1 MdWfdvjvArob9SUXakr4V0Ymj+VPJAMDvGosovZSi/U3HaJBpy35Nu3AldZd8AS1ZY4hyU3Eeav lQoYBMEwRj7oR/eytiQ3lGZpdE2ydqm2QWYU= X-Received: by 2002:a05:600c:54ca:b0:3cf:8e5d:7146 with SMTP id iw10-20020a05600c54ca00b003cf8e5d7146mr18675289wmb.191.1667900425634; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221108_014029_049256_36A03552 X-CRM114-Status: GOOD ( 21.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel