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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4D67C433EF for ; Mon, 7 Mar 2022 10:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241456AbiCGKyR (ORCPT ); Mon, 7 Mar 2022 05:54:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241567AbiCGKxq (ORCPT ); Mon, 7 Mar 2022 05:53:46 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 38EE1A646C for ; Mon, 7 Mar 2022 02:13:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647968; 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=EAtJPNtZqQT+pzIC8Y0yY8ijMFQMxHJn+7uAlJm9E2A=; b=UZ+SDSnDZF+VsXQQefNOfVqNhUYEVXSyB5COW9cgKPDjqCDYYi63cbRm5MbY8glNzzlGYa x4DgPQWgUDEb/WE8ygjXLrXp0XGKTG+QHqXsj4YK3Y7s5SIJSsqIRDU2oEoAaqI/kFN7Ow YhYnq6VcqsKznBAzdBvLP4T1gcK9vzM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-294-rJvlNr1nOhq8cCkiOuZR6w-1; Mon, 07 Mar 2022 05:12:47 -0500 X-MC-Unique: rJvlNr1nOhq8cCkiOuZR6w-1 Received: by mail-wr1-f72.google.com with SMTP id k20-20020adfc714000000b001e305cd1597so4364486wrg.19 for ; Mon, 07 Mar 2022 02:12:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=EAtJPNtZqQT+pzIC8Y0yY8ijMFQMxHJn+7uAlJm9E2A=; b=d66OV8Ic2Vw/pxnQ8mK0OjkDLi3wAdEtUW3RK/QsKaJfKvar45WD4Cf9cJb4QrBzdl WlovYnF4ALo/DOVYIiBo4RsMN3Rmb6BnUtDEQ0G4BfOv/UIFyW+LHITp33zozIWpn9Wq uBB3qIU31IE4uNHG6ARPgUpweFFG3Ku2Nduyo47FMwgnEo5eVgC96E4r1j99l4QAE1sb Y+XJjuZXJIf6LSOm++Mzjcl6PQB+mZJPZ/dg47XPQdlhv8QzKWKzbUODCAk8Y2aeLGnY v7jk5wJiWRL6U8bvym/lSBNbRgyZeG70YhgF5B6fkhfq/fCh/bTNGK1LsbEj87jq5zLc ZIJg== X-Gm-Message-State: AOAM533oIexrHzjFyYOodRcj2ARiJzsoeNNYbGn0oDaU3OncD4NmBgIp UtnteoT9ENN3TOXvOVprElayU6rh1bzQ/xKQHolp8bHcLyDmGmgvlKx8A3Qg87zHXMik1atYq1V +ddy/Rcif4kPW8QvqyEqlq+Ue7A== X-Received: by 2002:a5d:6046:0:b0:1f0:4973:142f with SMTP id j6-20020a5d6046000000b001f04973142fmr7674921wrt.538.1646647966518; Mon, 07 Mar 2022 02:12:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEV99RC6J+Vin5f1sKjrk/pcIneCd29UN8hGV1eMibccSf0NvkVF1D5zaL4pxEGhCcclmMGQ== X-Received: by 2002:a5d:6046:0:b0:1f0:4973:142f with SMTP id j6-20020a5d6046000000b001f04973142fmr7674887wrt.538.1646647966292; Mon, 07 Mar 2022 02:12:46 -0800 (PST) Received: from ?IPV6:2003:cb:c705:1e00:8d67:f75a:a8ae:dc02? (p200300cbc7051e008d67f75aa8aedc02.dip0.t-ipconnect.de. [2003:cb:c705:1e00:8d67:f75a:a8ae:dc02]) by smtp.gmail.com with ESMTPSA id bg18-20020a05600c3c9200b0037c2ef07493sm14954074wmb.3.2022.03.07.02.12.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Mar 2022 02:12:45 -0800 (PST) Message-ID: Date: Mon, 7 Mar 2022 11:12:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH RFC 0/3] MAP_POPULATE for device memory Content-Language: en-US To: Jarkko Sakkinen , linux-mm@kvack.org Cc: Dave Hansen , Nathaniel McCallum , Reinette Chatre , Andrew Morton , linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, Florian Fainelli , Thomas Bogendoerfer , Matthew Auld , =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= , Daniel Vetter , Jason Ekstrand , Chris Wilson , Maarten Lankhorst , Greg Kroah-Hartman , Tvrtko Ursulin , Vasily Averin , Shakeel Butt , Michal Hocko , zhangyiru , Alexey Gladkov , Alexander Mikhalitsyn , linux-mips@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, codalist@coda.cs.cmu.edu, linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20220306053211.135762-1-jarkko@kernel.org> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220306053211.135762-1-jarkko@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-unionfs@vger.kernel.org On 06.03.22 06:32, Jarkko Sakkinen wrote: > For device memory (aka VM_IO | VM_PFNMAP) MAP_POPULATE does nothing. Allow > to use that for initializing the device memory by providing a new callback > f_ops->populate() for the purpose. > > SGX patches are provided to show the callback in context. > > An obvious alternative is a ioctl but it is less elegant and requires > two syscalls (mmap + ioctl) per memory range, instead of just one > (mmap). What about extending MADV_POPULATE_READ | MADV_POPULATE_WRITE to support VM_IO | VM_PFNMAP (as well?) ? -- Thanks, David / dhildenb 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 72346C433FE for ; Mon, 7 Mar 2022 10:12:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E5EF10F115; Mon, 7 Mar 2022 10:12:53 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id BBBD210F114 for ; Mon, 7 Mar 2022 10:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647970; 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=EAtJPNtZqQT+pzIC8Y0yY8ijMFQMxHJn+7uAlJm9E2A=; b=Ap5JrlyFIm6Nqu766DUOeEhTHSDPQeURKKCN6Ik52vDoek/MTZxZZcQ5++BWaq+FEWfjM9 jocsfvYWMN02jbIIc3X8XRmnCfAMdNGmv+cr+Dskh3+qyy2SAtU5R2vx4QYJ3lOayD3M6D y/JDT8AhCYNIaRQRmMKmueuXMFUgeTY= 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-EvcNNXtKNgeL2VASOEMWjA-1; Mon, 07 Mar 2022 05:12:47 -0500 X-MC-Unique: EvcNNXtKNgeL2VASOEMWjA-1 Received: by mail-wm1-f71.google.com with SMTP id 26-20020a05600c22da00b00388307f3503so5187984wmg.1 for ; Mon, 07 Mar 2022 02:12:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=EAtJPNtZqQT+pzIC8Y0yY8ijMFQMxHJn+7uAlJm9E2A=; b=2FEyTrRLGa2iRtEj72VvxdAsR1Tx0i0sqr4EeVUvuvHGdt7XoVkj3XMvGrBL0bpkr7 PUkdE+YGBBE3ScOdDQ1UokDYgRKVRcHkQigpDH2tx+qzfInZJoi0qgdnq3aK2Yiqwb/4 xLfSV88MpOQMhKCchsx2qPNNUTIAv5VGVWl4dKIy97+YaT3QgZ1+5MldH13/QsZZ1w// CdGUqUBmx75LCIrsKbh3y6FQM4W9BVnGa8LWd44B7nRZAwGlSk6yYR7aSb2qeQaMj8cd Mb7ViC6+sw3YSn24e3LrvyS2QkMci32pvj0jUzir5OPD1WnUDN2z4fb9wLHuYM4SWn3C VqYg== X-Gm-Message-State: AOAM531JGzG2aPGkdAFQt7on3qCWH4WX9Hdk1DLJfaE/oCCFnUFo0TE2 Kj+sLBrogLtZXpbCLYiC/Zjv+s/NTiCmeS+Rkiufu3EzjuI5yye12ziYqYcNxylBFzy17Fu1tI4 ogLn5j3N3oA2PPzZayuuSWyrQs7pE X-Received: by 2002:a5d:6046:0:b0:1f0:4973:142f with SMTP id j6-20020a5d6046000000b001f04973142fmr7674911wrt.538.1646647966509; Mon, 07 Mar 2022 02:12:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEV99RC6J+Vin5f1sKjrk/pcIneCd29UN8hGV1eMibccSf0NvkVF1D5zaL4pxEGhCcclmMGQ== X-Received: by 2002:a5d:6046:0:b0:1f0:4973:142f with SMTP id j6-20020a5d6046000000b001f04973142fmr7674887wrt.538.1646647966292; Mon, 07 Mar 2022 02:12:46 -0800 (PST) Received: from ?IPV6:2003:cb:c705:1e00:8d67:f75a:a8ae:dc02? (p200300cbc7051e008d67f75aa8aedc02.dip0.t-ipconnect.de. [2003:cb:c705:1e00:8d67:f75a:a8ae:dc02]) by smtp.gmail.com with ESMTPSA id bg18-20020a05600c3c9200b0037c2ef07493sm14954074wmb.3.2022.03.07.02.12.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Mar 2022 02:12:45 -0800 (PST) Message-ID: Date: Mon, 7 Mar 2022 11:12:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH RFC 0/3] MAP_POPULATE for device memory To: Jarkko Sakkinen , linux-mm@kvack.org References: <20220306053211.135762-1-jarkko@kernel.org> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220306053211.135762-1-jarkko@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: , Cc: Michal Hocko , zhangyiru , Daniel Vetter , Dave Hansen , dri-devel@lists.freedesktop.org, Chris Wilson , Jason Ekstrand , Alexander Mikhalitsyn , Florian Fainelli , linux-unionfs@vger.kernel.org, codalist@coda.cs.cmu.edu, Matthew Auld , Vasily Averin , =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= , intel-gfx@lists.freedesktop.org, linux-mips@vger.kernel.org, Shakeel Butt , Reinette Chatre , linux-sgx@vger.kernel.org, Thomas Bogendoerfer , Nathaniel McCallum , Greg Kroah-Hartman , Tvrtko Ursulin , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Alexey Gladkov Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 06.03.22 06:32, Jarkko Sakkinen wrote: > For device memory (aka VM_IO | VM_PFNMAP) MAP_POPULATE does nothing. Allow > to use that for initializing the device memory by providing a new callback > f_ops->populate() for the purpose. > > SGX patches are provided to show the callback in context. > > An obvious alternative is a ioctl but it is less elegant and requires > two syscalls (mmap + ioctl) per memory range, instead of just one > (mmap). What about extending MADV_POPULATE_READ | MADV_POPULATE_WRITE to support VM_IO | VM_PFNMAP (as well?) ? -- Thanks, David / dhildenb 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4C090C433EF for ; Mon, 7 Mar 2022 10:12:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C4EBA10F114; Mon, 7 Mar 2022 10:12:52 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC1C010F115 for ; Mon, 7 Mar 2022 10:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647970; 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=EAtJPNtZqQT+pzIC8Y0yY8ijMFQMxHJn+7uAlJm9E2A=; b=Ap5JrlyFIm6Nqu766DUOeEhTHSDPQeURKKCN6Ik52vDoek/MTZxZZcQ5++BWaq+FEWfjM9 jocsfvYWMN02jbIIc3X8XRmnCfAMdNGmv+cr+Dskh3+qyy2SAtU5R2vx4QYJ3lOayD3M6D y/JDT8AhCYNIaRQRmMKmueuXMFUgeTY= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-GcUM-z6KNsquyplOoGkE-g-1; Mon, 07 Mar 2022 05:12:47 -0500 X-MC-Unique: GcUM-z6KNsquyplOoGkE-g-1 Received: by mail-wr1-f71.google.com with SMTP id z1-20020adfec81000000b001f1f7e7ec99so394235wrn.17 for ; Mon, 07 Mar 2022 02:12:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=EAtJPNtZqQT+pzIC8Y0yY8ijMFQMxHJn+7uAlJm9E2A=; b=2YSVXr+yxSWURLs/kPljUfJiiuMDt2arGB6ufVlBM4JwVRx+2suVlN8WxvSdYLKU1D fsXxYpz8VfFsnf7kSAIUFTGlePQqG8SN6rOEUv7i5++Nt26w1+4dy/+xnT2WJwpVfRQH n8Ck55D4jHhSL63ipSITtNxRw4Z46ffs7lO8hhRpBxqTR1wcmmk+gVTtH47OZZhpGVNh RIJmFZU+c3PY/88tiAM6OQq0I3/dBTUW8DpxlEtlASqFcvU5w6XeuXxQlRRXoY3XjOL/ Do/44jJNmnLObtODcybL01ikW97dPQEMHkcTgKc/7vzjt6moUiwar6Kl7OEm6hNiRTQZ y15g== X-Gm-Message-State: AOAM530s/GdWBniX8w3KuNYZ0lHbC2QKWqzKqJgFhfupa+rm35v+A+Av hGFU6rRe/xywVhIYqpR8aA0qqvGTND3QMhPbv8EcDISVC4MkBPJS0tdMRkJN0k3UrpKwodddedt INbf5ZtBVvFWrtLlrE/R5zGxZrZgv X-Received: by 2002:a5d:6046:0:b0:1f0:4973:142f with SMTP id j6-20020a5d6046000000b001f04973142fmr7674916wrt.538.1646647966511; Mon, 07 Mar 2022 02:12:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEV99RC6J+Vin5f1sKjrk/pcIneCd29UN8hGV1eMibccSf0NvkVF1D5zaL4pxEGhCcclmMGQ== X-Received: by 2002:a5d:6046:0:b0:1f0:4973:142f with SMTP id j6-20020a5d6046000000b001f04973142fmr7674887wrt.538.1646647966292; Mon, 07 Mar 2022 02:12:46 -0800 (PST) Received: from ?IPV6:2003:cb:c705:1e00:8d67:f75a:a8ae:dc02? (p200300cbc7051e008d67f75aa8aedc02.dip0.t-ipconnect.de. [2003:cb:c705:1e00:8d67:f75a:a8ae:dc02]) by smtp.gmail.com with ESMTPSA id bg18-20020a05600c3c9200b0037c2ef07493sm14954074wmb.3.2022.03.07.02.12.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Mar 2022 02:12:45 -0800 (PST) Message-ID: Date: Mon, 7 Mar 2022 11:12:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 To: Jarkko Sakkinen , linux-mm@kvack.org References: <20220306053211.135762-1-jarkko@kernel.org> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220306053211.135762-1-jarkko@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Intel-gfx] [PATCH RFC 0/3] MAP_POPULATE for device memory X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , zhangyiru , Daniel Vetter , Dave Hansen , dri-devel@lists.freedesktop.org, Chris Wilson , Alexander Mikhalitsyn , Florian Fainelli , linux-unionfs@vger.kernel.org, codalist@coda.cs.cmu.edu, Matthew Auld , Vasily Averin , =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= , intel-gfx@lists.freedesktop.org, linux-mips@vger.kernel.org, Shakeel Butt , Reinette Chatre , linux-sgx@vger.kernel.org, Thomas Bogendoerfer , Nathaniel McCallum , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Alexey Gladkov Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 06.03.22 06:32, Jarkko Sakkinen wrote: > For device memory (aka VM_IO | VM_PFNMAP) MAP_POPULATE does nothing. Allow > to use that for initializing the device memory by providing a new callback > f_ops->populate() for the purpose. > > SGX patches are provided to show the callback in context. > > An obvious alternative is a ioctl but it is less elegant and requires > two syscalls (mmap + ioctl) per memory range, instead of just one > (mmap). What about extending MADV_POPULATE_READ | MADV_POPULATE_WRITE to support VM_IO | VM_PFNMAP (as well?) ? -- Thanks, David / dhildenb