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=-4.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 337C3C43461 for ; Thu, 17 Sep 2020 12:24:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C05D32087D for ; Thu, 17 Sep 2020 12:24:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YSwvclpg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C05D32087D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 461246B0055; Thu, 17 Sep 2020 08:24:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 410F86B005A; Thu, 17 Sep 2020 08:24:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FFA96B005C; Thu, 17 Sep 2020 08:24:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id 17A336B0055 for ; Thu, 17 Sep 2020 08:24:34 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C96283635 for ; Thu, 17 Sep 2020 12:24:33 +0000 (UTC) X-FDA: 77272471626.30.lace98_200140827122 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 94B58180B3C83 for ; Thu, 17 Sep 2020 12:24:33 +0000 (UTC) X-HE-Tag: lace98_200140827122 X-Filterd-Recvd-Size: 5638 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 12:24:33 +0000 (UTC) Received: by mail-ed1-f52.google.com with SMTP id n13so2251827edo.10 for ; Thu, 17 Sep 2020 05:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=GBPWnK+O45hDPiwD6Yl2FVueQas8+06W2RHndFOU4x0=; b=YSwvclpgwQrjaZJLio4+fZCnlFslcy8Smk4D3Nl1taPur3YUbCtbgZhfm/6+rxDLDb wnpQZk8wKk/ZMKnF8vQJK7jlxVoRuJE6PwMpAZIlrRUdYNDuAbOMf896/BwdweSdvEDR egGfWHIWpyYNDLR+YDZFocW3Spw/+1H3TuHMdAE5hQV4Sa7vq171+oowCUwvVE1XPned BNGCHnafxMkf0uGcmrVb/SW+uYrSjukjUsITqm1O0eLlKXIQ//sx5vYoWXnSP9AjX43r JzICsn9YQNoT2j5O7gynMB4YyLqxhQ4BfDYgM40y/TSWY5dKWblFY0toaz+U49m5h2eD SrPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=GBPWnK+O45hDPiwD6Yl2FVueQas8+06W2RHndFOU4x0=; b=QgCLzyvEPn14EA0sOlRhLeJyLN2mlv4oX3Ib0qDc8twWAdFOVgdnow+Ozk0uZ9Mkbd DWhiXn31tkL5FJIqHUHnydV00PgvBFktemFTVl/9hUq7DtvqPHD5o4ElCVzl6b8n4BiD YOXrFNJkhz+zQnLwOCLxYF+yE/gDPBf+fkl9HBVBsfeIWUqd5M9kfl0KLt/45xtR+CJz YywHAuckdCgg93z8r5Owiz9Mc3zajtvQuAHVVaL0MHTfjmdFAscuKUeUpyX4C82awUPU +4sfUNc+Wv0P08C5TtpmX9lwR8jLUTJbRqjbw47K9XZ2W2vvw1P/dWUPUVbVy1N7Q5aV gkPA== X-Gm-Message-State: AOAM533iBMNw6U//22LsJTje2Hit9SQg+fg97dmMpdvUHz8sDeMdHo7p cY375IVuLdRUiKAvYHiqlWo= X-Google-Smtp-Source: ABdhPJxjg1yiXefIk0NeL3VjLQ2zbCP7yoFRn/H/W2k2rNszWXwepBIqx8bZOzhUQkVeMcmckHNfJw== X-Received: by 2002:a05:6402:1110:: with SMTP id u16mr32547477edv.253.1600345471990; Thu, 17 Sep 2020 05:24:31 -0700 (PDT) Received: from ?IPv6:2a02:908:1252:fb60:be8a:bd56:1f94:86e7? ([2a02:908:1252:fb60:be8a:bd56:1f94:86e7]) by smtp.gmail.com with ESMTPSA id b5sm16198291edq.69.2020.09.17.05.24.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Sep 2020 05:24:31 -0700 (PDT) Reply-To: christian.koenig@amd.com Subject: Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap() To: Jason Gunthorpe , christian.koenig@amd.com Cc: Linux Kernel Mailing List , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Linux MM , Daniel Vetter , Andrew Morton , "open list:DMA BUFFER SHARING FRAMEWORK" References: <20200916095359.GD438822@phenom.ffwll.local> <20200916140710.GA8409@ziepe.ca> <8db2474f-ecb7-0e17-5f5b-145708fe44d5@amd.com> <8d8693db-a3f0-4f5f-3e32-57d23ca620f8@amd.com> <20200917113110.GE8409@ziepe.ca> <6fd74b84-959c-8b3b-c27b-e9fbf66396c7@gmail.com> <20200917121858.GF8409@ziepe.ca> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Thu, 17 Sep 2020 14:24:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200917121858.GF8409@ziepe.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 94B58180B3C83 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable 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: Am 17.09.20 um 14:18 schrieb Jason Gunthorpe: > On Thu, Sep 17, 2020 at 02:03:48PM +0200, Christian K=C3=B6nig wrote: >> Am 17.09.20 um 13:31 schrieb Jason Gunthorpe: >>> On Thu, Sep 17, 2020 at 10:09:12AM +0200, Daniel Vetter wrote: >>> >>>> Yeah, but it doesn't work when forwarding from the drm chardev to th= e >>>> dma-buf on the importer side, since you'd need a ton of different >>>> address spaces. And you still rely on the core code picking up your >>>> pgoff mangling, which feels about as risky to me as the vma file >>>> pointer wrangling - if it's not consistently applied the reverse map >>>> is toast and unmap_mapping_range doesn't work correctly for our need= s. >>> I would think the pgoff has to be translated at the same time the >>> vm->vm_file is changed? >>> >>> The owner of the dma_buf should have one virtual address space and FD= , >>> all its dma bufs should be linked to it, and all pgoffs translated to >>> that space. >> Yeah, that is exactly like amdgpu is doing it. >> >> Going to document that somehow when I'm done with TTM cleanups. > BTW, while people are looking at this, is there a way to go from a VMA > to a dma_buf that owns it? Only a driver specific one. For TTM drivers vma->vm_private_data points to the buffer object. Not=20 sure about the drivers using GEM only. Why are you asking? Regards, Christian. > > Jason > _______________________________________________ > Linaro-mm-sig mailing list > Linaro-mm-sig@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/linaro-mm-sig