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.9 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 3365EC433E2 for ; Wed, 16 Sep 2020 15:31:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AC81122274 for ; Wed, 16 Sep 2020 15:31:36 +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="NonqZq3r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AC81122274 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 4DF3F8E0003; Wed, 16 Sep 2020 11:31:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48F0F8E0001; Wed, 16 Sep 2020 11:31:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37D478E0003; Wed, 16 Sep 2020 11:31:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 1EECE8E0001 for ; Wed, 16 Sep 2020 11:31:36 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DB109181AC9CC for ; Wed, 16 Sep 2020 15:31:35 +0000 (UTC) X-FDA: 77269314150.25.voice36_4b141962711b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 8BD791804E3B3 for ; Wed, 16 Sep 2020 15:31:35 +0000 (UTC) X-HE-Tag: voice36_4b141962711b X-Filterd-Recvd-Size: 6460 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Sep 2020 15:31:34 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id o8so10935362ejb.10 for ; Wed, 16 Sep 2020 08:31:34 -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=FFVIMLw/qCsSLnB7Hf2n5qox/a9OEmYxxlddH5dk/ng=; b=NonqZq3rUzQcLEzLa0eBBE1h+gfBuDVn6anZ5i79FdEzJ+JYlB5SF7WfWfG3Mqvcrz mpBRMc8amwyC7GvLim/gZecRiJ0vOCz1yEPW5AGY5gdgIiAxVnKaz6+8cQWgOOE1JBWo umZ7lUC4fu6kdAIr/pLSd3uACF3Leq/HOcTZ1qLED+2Dh1I4zZFDqYA3g7QkB/mkQbHh cq+zcHmwJnCTpRvWYKWZ+sW6FV/DqDnOPIEaE1u4XZmMa77U6nIxauuufDzKAfmeZ6Cl CnFDeB1TboTcq3DxTXjkmIxcdUlTEg1NlZE99ETZER7DASL0l92c2vwTdrneuKiaL0fS h6UA== 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=FFVIMLw/qCsSLnB7Hf2n5qox/a9OEmYxxlddH5dk/ng=; b=T+Kz7VglNiqt+ZYgTSVJbcNBvHWUwt3GxAjAsGiysot5ZBSZtHeg2ebddljKvjmjaX hrPunTQ5ZgODtfxAaovtPKOAu0AN7c0hrDshu1RAcAF1U7Gn444jh32Bk4S94PJXDKQR 5qxiW7wSearJt9A5J9FDNQX12MZ7CxAIfkjOYfoKnk6eLxcX0umgu54FxZLj+PdDD8V9 Zted9D7Fb9xO0IiiwMS/e356i7sZiOsL1hlrv6hFKlK3mm9Uc3mJyo/2MUZcS+Trfp0s sSCPqrWoP8kS3vy7lZh4h1yMl8Bl7FK4R05wUikArdsprv0cz0Cr+jb6euUbz1CJLEsU aOhg== X-Gm-Message-State: AOAM533ZVr58AQfrUvdwscPt1QYyH98tsoNsKN538qFrMpcVy6XyGGLA EQ+8bSeqd89B7eVLQqy5XMY= X-Google-Smtp-Source: ABdhPJx8ArZnxCH5L/M6w2OQ/SkKcPuPpgnzuN/T5LBMYwHsyZz643N/8p/J/r8TnQEqdpzY+GTdEQ== X-Received: by 2002:a17:906:d965:: with SMTP id rp5mr25015415ejb.364.1600270293644; Wed, 16 Sep 2020 08:31:33 -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 lo25sm12877150ejb.53.2020.09.16.08.31.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Sep 2020 08:31:33 -0700 (PDT) Reply-To: christian.koenig@amd.com Subject: Re: [Linaro-mm-sig] Changing vma->vm_file in dma_buf_mmap() To: Daniel Vetter , =?UTF-8?Q?Christian_K=c3=b6nig?= Cc: Linux MM , Linux Kernel Mailing List , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Jason Gunthorpe , Andrew Morton , "open list:DMA BUFFER SHARING FRAMEWORK" References: <20200914132920.59183-1-christian.koenig@amd.com> <40cd26ae-b855-4627-5a13-4dcea5d622f6@gmail.com> <20200914140632.GD1221970@ziepe.ca> <9302e4e0-0ff0-8b00-ada1-85feefb49e88@gmail.com> <20200916095359.GD438822@phenom.ffwll.local> <20200916140710.GA8409@ziepe.ca> <8db2474f-ecb7-0e17-5f5b-145708fe44d5@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Wed, 16 Sep 2020 17:31:31 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 8BD791804E3B3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 16.09.20 um 17:24 schrieb Daniel Vetter: > On Wed, Sep 16, 2020 at 4:14 PM Christian K=C3=B6nig > wrote: >> Am 16.09.20 um 16:07 schrieb Jason Gunthorpe: >>> On Wed, Sep 16, 2020 at 11:53:59AM +0200, Daniel Vetter wrote: >>> >>>> But within the driver, we generally need thousands of these, and tha= t >>>> tends to bring fd exhaustion problems with it. That's why all the pr= ivate >>>> buffer objects which aren't shared with other process or other drive= rs are >>>> handles only valid for a specific fd instance of the drm chardev (ea= ch >>>> open gets their own namespace), and only for ioctls done on that cha= rdev. >>>> And for mmap we assign fake (but unique across all open fd on it) of= fsets >>>> within the overall chardev. Hence all the pgoff mangling and re-mang= ling. >>> Are they still unique struct files? Just without a fdno? >> Yes, exactly. > Not entirely, since dma-buf happened after drm chardev, so for that > historical reason the underlying struct file is shared, since it's the > drm chardev. But since that's per-device we don't have a problem in > practice with different vm_ops, since those are also per-device. But > yeah we could fish out some entirely hidden per-object struct file if > that's required for some mm internal reasons. Hui? Ok that is just the handling in i915, isn't it? As far as I know we create an unique struct file for each DMA-buf. Regards, Christian. > -Daniel > >>>> Hence why we'd like to be able to forward aliasing mappings and adju= st the >>>> file and pgoff, while hopefully everything keeps working. I thought = this >>>> would work, but Christian noticed it doesn't really. >>> It seems reasonable to me that the dma buf should be the owner of the >>> VMA, otherwise like you say, there is a big mess attaching the custom >>> vma ops and what not to the proper dma buf. >>> >>> I don't see anything obviously against this in mmap_region() - why di= d >>> Chritian notice it doesn't really work? >> To clarify I think this might work. >> >> I just had the same "Is that legal?", "What about security?", etc.. >> questions you raised as well. >> >> It seems like a source of trouble so I thought better ask somebody mor= e >> familiar with that. >> >> Christian. >> >>> Jason >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >