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 X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E498FC433DF for ; Tue, 25 Aug 2020 08:33:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B227620706 for ; Tue, 25 Aug 2020 08:33:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vZUFpZDB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="X9RY+o6s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B227620706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1tuy/Fbvc+3pTbUPbvTOn6VjoP1IIVRNAy1vetDWvxw=; b=vZUFpZDBIXIrLOijL73aTr+M5 99uNMFsV7vvZfMyBFFMWWvNstEla1AaFatqS3zxyC5N1+nXUtOUU//jwzHFM2prexNpfI9Fa4v+1J 82Xv0zWrq3uDTw1umkqiBiVO/mJUAGKPcY48NiXpRUU2RXEPahC372w8vaHb1ZjtP26YoIgjde4uu yi2p1E3q9UKk8/LZpwsLOVompfe2PrTFRZ2NqLK1K7EJ4r09PXGCB900ybcEDWrOGjaZrFe8GDtOk lalKsDkqQb5ws3ANOahZNvUviYmHZw7A/6oBzGfmCPSAMLtQz2JIE4ycnP9pFxwFi/4Njh1gGbgTE NHNsEiSXQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAUNI-0006po-BX; Tue, 25 Aug 2020 08:32:12 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAUNG-0006of-CV for linux-arm-kernel@lists.infradead.org; Tue, 25 Aug 2020 08:32:11 +0000 Received: by mail-lf1-x142.google.com with SMTP id c15so5958886lfi.3 for ; Tue, 25 Aug 2020 01:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8VBcmM6sRKWlq0/anJb0wKs91ISNtH5ktL2MLmE99og=; b=X9RY+o6sC9Ppm0S92JcWuGapwVP6vGdg7BjmyO+bVW0rj1WTbhhQsV4pHkqkwAjjaN 8H/JJC5//XVna28iO68xRVOv9wU5x6YXvvotlGw4lLejKAMz/7Q00mTo0f967W4aMtUw fPiG3HQHt/fd2KN89nN8sEf0oVh56pcOds4wS0HQdO+5Lb+PNySRcvEGwgy4lHZefIy5 rpPA57c8RiRxZCxSfGlU1duSCLz3LMQ8/pSg+8uvHvNSWoz0nBeDuyncKVeR1U7EwtMq czWKRkH2JC3rN+Vs1JuY98vwSztqYkw2+2QSwv4wCzy/Zrvk0+76s1xbiZ0f2HRzJS2N lsAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8VBcmM6sRKWlq0/anJb0wKs91ISNtH5ktL2MLmE99og=; b=bdZNs7v7+jcLCAlIuLvF2+Vey+/a7Ur3Im6YrWPwT4fdrw43SQPloYIgQKXXMTC9HL 26cFkE01SHFUZtq6m7Lbwi3nrPiQ2WXsCVvZKJ+aZ1uHBVaAy1lLREIkPbD0C788xETk 3JoUBlG7SUI3NneBvI8UYddeOnfwZ8wn3MQ7KPJd5quf/qWMLRPqmyaHtqBova3C/RtB cw8YXZIeAGZ1TvgCLY9ZYjv2Tfm8xcN4u5f+qVeIiYQfceUop8dLfbBX2Dw26IHkFK8X Dap/NQCcvgAyoASD/UBW0u2t9KIthZRWUOlOGVBMC26rVm5reaVR5HLMRt9SEDrvIwGq LZKg== X-Gm-Message-State: AOAM530LPMb7B9LPvKM7QDfXIYWeIYHfOIe9stUQ4qYKLRK33bIjDPcn ifcS3FQHy47cjkqwW4q1JsVZ0w== X-Google-Smtp-Source: ABdhPJyvP5CCC/9K1+399P66A5Xf4E5azNewtsF/LKST22V5Yw1PmUGF53lGY/lu2kWSsQNejxGZUA== X-Received: by 2002:ac2:4570:: with SMTP id k16mr4396381lfm.60.1598344327410; Tue, 25 Aug 2020 01:32:07 -0700 (PDT) Received: from jade (h-249-223.A175.priv.bahnhof.se. [98.128.249.223]) by smtp.gmail.com with ESMTPSA id f14sm2666979ljp.138.2020.08.25.01.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 01:32:06 -0700 (PDT) Date: Tue, 25 Aug 2020 10:32:04 +0200 From: Jens Wiklander To: John Hubbard Subject: Re: [PATCH v3] tee: convert convert get_user_pages() --> pin_user_pages() Message-ID: <20200825083204.GA2068961@jade> References: <20200824211125.1867329-1-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200824211125.1867329-1-jhubbard@nvidia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200825_043210_511370_1D138198 X-CRM114-Status: GOOD ( 16.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: Cc: linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, tee-dev@lists.linaro.org, soc@kernel.org, arm@kernel.org, olof@lixom.net, Sumit Semwal , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 24, 2020 at 02:11:25PM -0700, John Hubbard wrote: > This code was using get_user_pages*(), in a "Case 2" scenario > (DMA/RDMA), using the categorization from [1]. That means that it's > time to convert the get_user_pages*() + put_page() calls to > pin_user_pages*() + unpin_user_pages() calls. > > Factor out a new, small release_registered_pages() function, in > order to consolidate the logic for discerning between > TEE_SHM_USER_MAPPED and TEE_SHM_KERNEL_MAPPED pages. This also > absorbs the kfree() call that is also required there. > > There is some helpful background in [2]: basically, this is a small > part of fixing a long-standing disconnect between pinning pages, and > file systems' use of those pages. > > [1] Documentation/core-api/pin_user_pages.rst > > [2] "Explicit pinning of user-space pages": > https://lwn.net/Articles/807108/ > > Cc: Jens Wiklander > Cc: Sumit Semwal > Cc: tee-dev@lists.linaro.org > Cc: linux-media@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > Cc: linaro-mm-sig@lists.linaro.org > Signed-off-by: John Hubbard > --- > > OK, one more try, this time actually handling the _USER_MAPPED vs. > _KERNEL_MAPPED pages! > > thanks, > John Hubbard > NVIDIA Looks good and it works too! :-) I've tested it on my Hikey board with the OP-TEE test suite. I'm picking this up. Thanks, Jens _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4B6FC433E1 for ; Wed, 26 Aug 2020 08:05:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89FDC20838 for ; Wed, 26 Aug 2020 08:05:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="X9RY+o6s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89FDC20838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 79BBD6EA3A; Wed, 26 Aug 2020 08:04:51 +0000 (UTC) Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id 134816E88C for ; Tue, 25 Aug 2020 08:32:09 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id d16so490615lfs.10 for ; Tue, 25 Aug 2020 01:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8VBcmM6sRKWlq0/anJb0wKs91ISNtH5ktL2MLmE99og=; b=X9RY+o6sC9Ppm0S92JcWuGapwVP6vGdg7BjmyO+bVW0rj1WTbhhQsV4pHkqkwAjjaN 8H/JJC5//XVna28iO68xRVOv9wU5x6YXvvotlGw4lLejKAMz/7Q00mTo0f967W4aMtUw fPiG3HQHt/fd2KN89nN8sEf0oVh56pcOds4wS0HQdO+5Lb+PNySRcvEGwgy4lHZefIy5 rpPA57c8RiRxZCxSfGlU1duSCLz3LMQ8/pSg+8uvHvNSWoz0nBeDuyncKVeR1U7EwtMq czWKRkH2JC3rN+Vs1JuY98vwSztqYkw2+2QSwv4wCzy/Zrvk0+76s1xbiZ0f2HRzJS2N lsAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8VBcmM6sRKWlq0/anJb0wKs91ISNtH5ktL2MLmE99og=; b=GK+fJa8nBvko+LevwqBZGvslTo+xjbbymctR2MX71g0SZyP9hOhNr31sUslH+e4plD STL6xWn8zA8vrm0Q8GjoOAM+x14ZQobgsPpv4ZhxI2E2TbNF0xA/hbH4TVvZVk7qEWdl x3aLSTw2F6pJJgoi+vmCFLreOiymwubvq3x4NCUXySmmrVJXNqoXua0AOyCfVWg8RW/g QXLk3cqdut7RRyHBguNu+5rELwWDk3wbT6jLV2Pb8QfffD6W9NvY2KSpr56VlbXdL2yZ YYmwOXnZ3mzA504+2pylgARsyGItF1/uc0O3fqTVt0Bf8KD2KOZulLXfwsR63G/vjMDt VKrQ== X-Gm-Message-State: AOAM53346Bo4iybzd4b1ur4LSa4pxIZ9VcZKJxzQvCxv1CKze0IfZ1k/ LARIj+h5AfZeOe3YNkTjnbEjNw== X-Google-Smtp-Source: ABdhPJyvP5CCC/9K1+399P66A5Xf4E5azNewtsF/LKST22V5Yw1PmUGF53lGY/lu2kWSsQNejxGZUA== X-Received: by 2002:ac2:4570:: with SMTP id k16mr4396381lfm.60.1598344327410; Tue, 25 Aug 2020 01:32:07 -0700 (PDT) Received: from jade (h-249-223.A175.priv.bahnhof.se. [98.128.249.223]) by smtp.gmail.com with ESMTPSA id f14sm2666979ljp.138.2020.08.25.01.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 01:32:06 -0700 (PDT) Date: Tue, 25 Aug 2020 10:32:04 +0200 From: Jens Wiklander To: John Hubbard Subject: Re: [PATCH v3] tee: convert convert get_user_pages() --> pin_user_pages() Message-ID: <20200825083204.GA2068961@jade> References: <20200824211125.1867329-1-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200824211125.1867329-1-jhubbard@nvidia.com> X-Mailman-Approved-At: Wed, 26 Aug 2020 08:04:49 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: Cc: linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, tee-dev@lists.linaro.org, soc@kernel.org, arm@kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Aug 24, 2020 at 02:11:25PM -0700, John Hubbard wrote: > This code was using get_user_pages*(), in a "Case 2" scenario > (DMA/RDMA), using the categorization from [1]. That means that it's > time to convert the get_user_pages*() + put_page() calls to > pin_user_pages*() + unpin_user_pages() calls. > > Factor out a new, small release_registered_pages() function, in > order to consolidate the logic for discerning between > TEE_SHM_USER_MAPPED and TEE_SHM_KERNEL_MAPPED pages. This also > absorbs the kfree() call that is also required there. > > There is some helpful background in [2]: basically, this is a small > part of fixing a long-standing disconnect between pinning pages, and > file systems' use of those pages. > > [1] Documentation/core-api/pin_user_pages.rst > > [2] "Explicit pinning of user-space pages": > https://lwn.net/Articles/807108/ > > Cc: Jens Wiklander > Cc: Sumit Semwal > Cc: tee-dev@lists.linaro.org > Cc: linux-media@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > Cc: linaro-mm-sig@lists.linaro.org > Signed-off-by: John Hubbard > --- > > OK, one more try, this time actually handling the _USER_MAPPED vs. > _KERNEL_MAPPED pages! > > thanks, > John Hubbard > NVIDIA Looks good and it works too! :-) I've tested it on my Hikey board with the OP-TEE test suite. I'm picking this up. Thanks, Jens _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95BBFC433E1 for ; Tue, 25 Aug 2020 08:32:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 712CB20706 for ; Tue, 25 Aug 2020 08:32:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="X9RY+o6s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729254AbgHYIcM (ORCPT ); Tue, 25 Aug 2020 04:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728131AbgHYIcK (ORCPT ); Tue, 25 Aug 2020 04:32:10 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 189B8C061755 for ; Tue, 25 Aug 2020 01:32:09 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id 145so3090919lfi.8 for ; Tue, 25 Aug 2020 01:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8VBcmM6sRKWlq0/anJb0wKs91ISNtH5ktL2MLmE99og=; b=X9RY+o6sC9Ppm0S92JcWuGapwVP6vGdg7BjmyO+bVW0rj1WTbhhQsV4pHkqkwAjjaN 8H/JJC5//XVna28iO68xRVOv9wU5x6YXvvotlGw4lLejKAMz/7Q00mTo0f967W4aMtUw fPiG3HQHt/fd2KN89nN8sEf0oVh56pcOds4wS0HQdO+5Lb+PNySRcvEGwgy4lHZefIy5 rpPA57c8RiRxZCxSfGlU1duSCLz3LMQ8/pSg+8uvHvNSWoz0nBeDuyncKVeR1U7EwtMq czWKRkH2JC3rN+Vs1JuY98vwSztqYkw2+2QSwv4wCzy/Zrvk0+76s1xbiZ0f2HRzJS2N lsAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8VBcmM6sRKWlq0/anJb0wKs91ISNtH5ktL2MLmE99og=; b=EGsLNtzrgPEET80TsIEhK5wWmUAaMEU8KeDEC10JQCUmSSbQgzYJJZQZIgHihUvhUP f5KDxidqTNfIagWiGeSuMbF56k+Daky5R/TJyPGlME+zDdYUwviO8mb9mrSwOi/YNQIs GmzXHD8LdWXZ3Ge50uaA6ymF3IL99Doajajba7dDY/skWVDg1I5qqniVdTN+HAfpbd8v qZWd1DWqHGK5/EvKn8XENQaqfqh/6+166OBDERuuDucUBMSz6sr78eGgI1Xy2o3ge0of oDUeOUFEWWR3TLmsaH+z8xrJJ1eZDkeQNdJFgAQiNO8fTUZiwUakMDVcfJPlmlxgZ9kE vUZw== X-Gm-Message-State: AOAM5310KrT8IwtQj9ILIYVEz80tFG/V2nrsTfiwdVUdG6JZmPZUDc6Y w/8u2nKvSxkqLoZv6QxRCYLd4gA7e6vfJA== X-Google-Smtp-Source: ABdhPJyvP5CCC/9K1+399P66A5Xf4E5azNewtsF/LKST22V5Yw1PmUGF53lGY/lu2kWSsQNejxGZUA== X-Received: by 2002:ac2:4570:: with SMTP id k16mr4396381lfm.60.1598344327410; Tue, 25 Aug 2020 01:32:07 -0700 (PDT) Received: from jade (h-249-223.A175.priv.bahnhof.se. [98.128.249.223]) by smtp.gmail.com with ESMTPSA id f14sm2666979ljp.138.2020.08.25.01.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 01:32:06 -0700 (PDT) Date: Tue, 25 Aug 2020 10:32:04 +0200 From: Jens Wiklander To: John Hubbard List-Id: Cc: arm@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, olof@lixom.net, soc@kernel.org, tee-dev@lists.linaro.org, Sumit Semwal , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Subject: Re: [PATCH v3] tee: convert convert get_user_pages() --> pin_user_pages() Message-ID: <20200825083204.GA2068961@jade> References: <20200824211125.1867329-1-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200824211125.1867329-1-jhubbard@nvidia.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Mon, Aug 24, 2020 at 02:11:25PM -0700, John Hubbard wrote: > This code was using get_user_pages*(), in a "Case 2" scenario > (DMA/RDMA), using the categorization from [1]. That means that it's > time to convert the get_user_pages*() + put_page() calls to > pin_user_pages*() + unpin_user_pages() calls. > > Factor out a new, small release_registered_pages() function, in > order to consolidate the logic for discerning between > TEE_SHM_USER_MAPPED and TEE_SHM_KERNEL_MAPPED pages. This also > absorbs the kfree() call that is also required there. > > There is some helpful background in [2]: basically, this is a small > part of fixing a long-standing disconnect between pinning pages, and > file systems' use of those pages. > > [1] Documentation/core-api/pin_user_pages.rst > > [2] "Explicit pinning of user-space pages": > https://lwn.net/Articles/807108/ > > Cc: Jens Wiklander > Cc: Sumit Semwal > Cc: tee-dev@lists.linaro.org > Cc: linux-media@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > Cc: linaro-mm-sig@lists.linaro.org > Signed-off-by: John Hubbard > --- > > OK, one more try, this time actually handling the _USER_MAPPED vs. > _KERNEL_MAPPED pages! > > thanks, > John Hubbard > NVIDIA Looks good and it works too! :-) I've tested it on my Hikey board with the OP-TEE test suite. I'm picking this up. Thanks, Jens