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.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 E6ABCC47255 for ; Mon, 11 May 2020 15:29:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCCD72070B for ; Mon, 11 May 2020 15:29:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Lg++tOm6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728556AbgEKP3I (ORCPT ); Mon, 11 May 2020 11:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726934AbgEKP3I (ORCPT ); Mon, 11 May 2020 11:29:08 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E30CEC061A0C for ; Mon, 11 May 2020 08:29:07 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id a2so15219890oia.11 for ; Mon, 11 May 2020 08:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jr8BqxYa5N2UQFIWCH+ZeFGjIUjI6K0QpaYQti5dmF0=; b=Lg++tOm6IwiIzgdNtd59XFNZ5Rmlo64vDv1d4OxItcq8FR+s48C8JwmCXbAKorjZ6J YMSEEwHXoSig7JadxHN8PtMZuZemoD+1KjSnSKqfgM2CBbOHJslVSimDSF7trCKxPCQU IZR0vJPAXGKhAKd75Zi+m8C4aIcjuV9t7jzbg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jr8BqxYa5N2UQFIWCH+ZeFGjIUjI6K0QpaYQti5dmF0=; b=TU5KPPs1RfgAjTEjNTFJ88YS/OA+xpss3Nt7DOfgxO+zzh6afFHvoKlR+c/s4JPFaf 7674G9cBSbDe/A9gREmc2T7XrakPKF6YB9pwDHOrTIZ6VJ6o7vFHSMEvqNjJM9jMOwkt OOwI4dHme4AAFyCm5bEmnXa8F1napCjlp3N86G/dqUd0Y2+U7DZhn9Tp6IrCNOcdc38F +TMnqOH8OLg22QjnXosvSXezRDCgZOQArzB1AoVspQi9c+i/hcYYGPWOK2S1gh8bMz9P eD97tnZGmasY6kMn4nhEon0muFrRGFJS0S0grlRgURT0OYR8dtUaS3QhvaonTQAfcFtP am/w== X-Gm-Message-State: AGi0PuazMLXNkJ17AsGC/LU3YO8DwbpdIt4gBJS59r3uRLWexwzljQDS 0IohaGl2e1mXMWZDLSdrRfpv4xXLY210+IKsTNsdxw== X-Google-Smtp-Source: APiQypKoTHn0cJuzKGjhu51d/sGUsrkJZ4SrSZew0vSiBm3gQMc/ep2bCh/uj8x3VtDMZyNngfdYdPlUlBeH3a6m4Zs= X-Received: by 2002:aca:2113:: with SMTP id 19mr11528686oiz.128.1589210947246; Mon, 11 May 2020 08:29:07 -0700 (PDT) MIME-Version: 1.0 References: <20200511093554.211493-1-daniel.vetter@ffwll.ch> <20200511093554.211493-2-daniel.vetter@ffwll.ch> In-Reply-To: From: Daniel Vetter Date: Mon, 11 May 2020 17:28:56 +0200 Message-ID: Subject: Re: [PATCH 1/9] drm/msm: Don't call dma_buf_vunmap without _vmap To: Rob Clark Cc: DRI Development , Intel Graphics Development , Daniel Vetter , Sean Paul , linux-arm-msm , freedreno Content-Type: text/plain; charset="UTF-8" Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Mon, May 11, 2020 at 5:24 PM Rob Clark wrote: > > On Mon, May 11, 2020 at 2:36 AM Daniel Vetter wrote: > > > > I honestly don't exactly understand what's going on here, but the > > current code is wrong for sure: It calls dma_buf_vunmap without ever > > calling dma_buf_vmap. > > > > What I'm not sure about is whether the WARN_ON is correct: > > - msm imports dma-buf using drm_prime_sg_to_page_addr_arrays. Which is > > a pretty neat layering violation of how you shouldn't peek behind > > the curtain of the dma-buf exporter, but par for course. Note that > > all the nice new helpers don't (and we should probably have a bit a > > warning about this in the kerneldoc). > > > > - but then in the get_vaddr() in msm_gem.c, and that seems to happily > > wrap a vmap() around any object with ->pages set (so including > > imported dma-buf) > > > > - I'm not seeing any guarantees that userspace can't use an imported > > dma-buf for e.g. MSM_SUBMIT_CMD_BUF in a5xx_submit_in_rb, so no > > guarantees that an imported dma-buf won't end up with a ->vaddr set. > > fwiw, a5xx_submit_in_rb() isn't a "normal" path (build-time disabled > by default, and restricted to sudo).. it really only exists to > simplify poking at fw. > > There could be vmap's in the msm_gem_submit path, however. If we > don't, we should probably just disallow using an imported dma-buf as > cmdstream.. I don't think there is any sane reason to permit that. We > should probably also disallow get_vaddr() on imported buffers. Yeah if that's possible and won't blow up (I can't test) I think it'd be best. Something like if (bo->import_attach) return NULL; should do the trick I think. Should I type that up as v2 of this? -Daniel > > BR, > -R > > > > > But even if that WARN_ON is wrong, cleaning up a vmap() done by msm by > > calling dma_buf_vmap is the wrong thing to do. > > > > Signed-off-by: Daniel Vetter > > Cc: Rob Clark > > Cc: Sean Paul > > Cc: linux-arm-msm@vger.kernel.org > > Cc: freedreno@lists.freedesktop.org > > --- > > drivers/gpu/drm/msm/msm_gem.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c > > index 5a6a79fbc9d6..3305a457960e 100644 > > --- a/drivers/gpu/drm/msm/msm_gem.c > > +++ b/drivers/gpu/drm/msm/msm_gem.c > > @@ -907,8 +907,7 @@ static void free_object(struct msm_gem_object *msm_obj) > > put_iova(obj); > > > > if (obj->import_attach) { > > - if (msm_obj->vaddr) > > - dma_buf_vunmap(obj->import_attach->dmabuf, msm_obj->vaddr); > > + WARN_ON(msm_obj->vaddr); > > > > /* Don't drop the pages for imported dmabuf, as they are not > > * ours, just free the array we allocated: > > -- > > 2.26.2 > > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch 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=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 06F1EC54E8D for ; Mon, 11 May 2020 15:29:09 +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 D0FD520746 for ; Mon, 11 May 2020 15:29:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Lg++tOm6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0FD520746 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 3E0F389AB7; Mon, 11 May 2020 15:29:08 +0000 (UTC) Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0640689AB7 for ; Mon, 11 May 2020 15:29:08 +0000 (UTC) Received: by mail-oi1-x244.google.com with SMTP id j16so15397469oih.10 for ; Mon, 11 May 2020 08:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jr8BqxYa5N2UQFIWCH+ZeFGjIUjI6K0QpaYQti5dmF0=; b=Lg++tOm6IwiIzgdNtd59XFNZ5Rmlo64vDv1d4OxItcq8FR+s48C8JwmCXbAKorjZ6J YMSEEwHXoSig7JadxHN8PtMZuZemoD+1KjSnSKqfgM2CBbOHJslVSimDSF7trCKxPCQU IZR0vJPAXGKhAKd75Zi+m8C4aIcjuV9t7jzbg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jr8BqxYa5N2UQFIWCH+ZeFGjIUjI6K0QpaYQti5dmF0=; b=WLrQmOYXFEp7SzAib7En2LUkS9CSpweGULKvSW7sZHK+cHpinZ88C3b6z8ipAnh5Lt CIRVt8l+Ty8gur16CHaRv2AjsqfBAqGHTXn67VHzIZwzRP3dDcC/VexLE84OPWVUCkof HFDwhNC1kZdVRG6sLYQc5kTWGimN/L5RjmUN9GRan07S58mK/JMu5JGhLxBT0ekDX4X3 FYxxyQTt9ZtCt7SbwOxCNR84j2dU/gGc7TvPUfaq0fPDTiHdXCbOlQ11KLkio2UsuDym LUzBqhb2ZfG2IHIc96tt9BIQ7hzp3Jgl1maJ5153J+P1Yfh1ZkXyA+wVy60Yvqmo3PsO 6dCQ== X-Gm-Message-State: AGi0PuYjOSC+tguL98ruMlVqSHSVA07armwghd2mjadP25SnyXvzdx5u GnL+p1E8yV9ASFooV9yjm/O+4K2KacR3PD1w4IuVjQ== X-Google-Smtp-Source: APiQypKoTHn0cJuzKGjhu51d/sGUsrkJZ4SrSZew0vSiBm3gQMc/ep2bCh/uj8x3VtDMZyNngfdYdPlUlBeH3a6m4Zs= X-Received: by 2002:aca:2113:: with SMTP id 19mr11528686oiz.128.1589210947246; Mon, 11 May 2020 08:29:07 -0700 (PDT) MIME-Version: 1.0 References: <20200511093554.211493-1-daniel.vetter@ffwll.ch> <20200511093554.211493-2-daniel.vetter@ffwll.ch> In-Reply-To: From: Daniel Vetter Date: Mon, 11 May 2020 17:28:56 +0200 Message-ID: Subject: Re: [PATCH 1/9] drm/msm: Don't call dma_buf_vunmap without _vmap To: Rob Clark 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: Sean Paul , Intel Graphics Development , DRI Development , linux-arm-msm , Daniel Vetter , freedreno Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, May 11, 2020 at 5:24 PM Rob Clark wrote: > > On Mon, May 11, 2020 at 2:36 AM Daniel Vetter wrote: > > > > I honestly don't exactly understand what's going on here, but the > > current code is wrong for sure: It calls dma_buf_vunmap without ever > > calling dma_buf_vmap. > > > > What I'm not sure about is whether the WARN_ON is correct: > > - msm imports dma-buf using drm_prime_sg_to_page_addr_arrays. Which is > > a pretty neat layering violation of how you shouldn't peek behind > > the curtain of the dma-buf exporter, but par for course. Note that > > all the nice new helpers don't (and we should probably have a bit a > > warning about this in the kerneldoc). > > > > - but then in the get_vaddr() in msm_gem.c, and that seems to happily > > wrap a vmap() around any object with ->pages set (so including > > imported dma-buf) > > > > - I'm not seeing any guarantees that userspace can't use an imported > > dma-buf for e.g. MSM_SUBMIT_CMD_BUF in a5xx_submit_in_rb, so no > > guarantees that an imported dma-buf won't end up with a ->vaddr set. > > fwiw, a5xx_submit_in_rb() isn't a "normal" path (build-time disabled > by default, and restricted to sudo).. it really only exists to > simplify poking at fw. > > There could be vmap's in the msm_gem_submit path, however. If we > don't, we should probably just disallow using an imported dma-buf as > cmdstream.. I don't think there is any sane reason to permit that. We > should probably also disallow get_vaddr() on imported buffers. Yeah if that's possible and won't blow up (I can't test) I think it'd be best. Something like if (bo->import_attach) return NULL; should do the trick I think. Should I type that up as v2 of this? -Daniel > > BR, > -R > > > > > But even if that WARN_ON is wrong, cleaning up a vmap() done by msm by > > calling dma_buf_vmap is the wrong thing to do. > > > > Signed-off-by: Daniel Vetter > > Cc: Rob Clark > > Cc: Sean Paul > > Cc: linux-arm-msm@vger.kernel.org > > Cc: freedreno@lists.freedesktop.org > > --- > > drivers/gpu/drm/msm/msm_gem.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c > > index 5a6a79fbc9d6..3305a457960e 100644 > > --- a/drivers/gpu/drm/msm/msm_gem.c > > +++ b/drivers/gpu/drm/msm/msm_gem.c > > @@ -907,8 +907,7 @@ static void free_object(struct msm_gem_object *msm_obj) > > put_iova(obj); > > > > if (obj->import_attach) { > > - if (msm_obj->vaddr) > > - dma_buf_vunmap(obj->import_attach->dmabuf, msm_obj->vaddr); > > + WARN_ON(msm_obj->vaddr); > > > > /* Don't drop the pages for imported dmabuf, as they are not > > * ours, just free the array we allocated: > > -- > > 2.26.2 > > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ 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.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 31A9FC47255 for ; Mon, 11 May 2020 15:29:12 +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 0808E20675 for ; Mon, 11 May 2020 15:29:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Lg++tOm6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0808E20675 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 17BB66E4D2; Mon, 11 May 2020 15:29:09 +0000 (UTC) Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 099EE6E4D2 for ; Mon, 11 May 2020 15:29:08 +0000 (UTC) Received: by mail-oi1-x241.google.com with SMTP id o24so15437750oic.0 for ; Mon, 11 May 2020 08:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jr8BqxYa5N2UQFIWCH+ZeFGjIUjI6K0QpaYQti5dmF0=; b=Lg++tOm6IwiIzgdNtd59XFNZ5Rmlo64vDv1d4OxItcq8FR+s48C8JwmCXbAKorjZ6J YMSEEwHXoSig7JadxHN8PtMZuZemoD+1KjSnSKqfgM2CBbOHJslVSimDSF7trCKxPCQU IZR0vJPAXGKhAKd75Zi+m8C4aIcjuV9t7jzbg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jr8BqxYa5N2UQFIWCH+ZeFGjIUjI6K0QpaYQti5dmF0=; b=SMgggbLMBGT38/ojUVoquoGu6rEadJ7bsCjG0OKwcaRtcBK0YggOV1Z771Tjay3Tp7 6jJoTIV0zMfh3Z+AF1EsU91pY446qQg4uDfmqaXCtdBBAbKep6clcU/qj/gYIfpvTChE 931D0wqfrs9TM+KgKxd755eWfpLbZbRiWkXHF+m3RfDbzTdtrb3P+j/3ttSnmEYqU8gp 0gwh28By6ivdBP4Ll5Jc0pRBoLgf76fLYcJ219kofKqLh660Keq5zywbK9yoQVigVuQ2 ZgNGm892sUoQuu8jOH2kzuVDRoJPnKwtgbrVv3O906lR3n6eZgrVtUylS+323KHZME6u dmEA== X-Gm-Message-State: AGi0PuYLDc+sjBKACw/N7DPQNsC9kEgqLPbkIFmoxBenNKFVJYRPaBif +WBeZSkL+bkkLNf1qJ7Y6dMvPBvNEG1Yr9ReJpFIYdTX X-Google-Smtp-Source: APiQypKoTHn0cJuzKGjhu51d/sGUsrkJZ4SrSZew0vSiBm3gQMc/ep2bCh/uj8x3VtDMZyNngfdYdPlUlBeH3a6m4Zs= X-Received: by 2002:aca:2113:: with SMTP id 19mr11528686oiz.128.1589210947246; Mon, 11 May 2020 08:29:07 -0700 (PDT) MIME-Version: 1.0 References: <20200511093554.211493-1-daniel.vetter@ffwll.ch> <20200511093554.211493-2-daniel.vetter@ffwll.ch> In-Reply-To: From: Daniel Vetter Date: Mon, 11 May 2020 17:28:56 +0200 Message-ID: To: Rob Clark Subject: Re: [Intel-gfx] [PATCH 1/9] drm/msm: Don't call dma_buf_vunmap without _vmap 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: Intel Graphics Development , DRI Development , linux-arm-msm , Daniel Vetter , freedreno Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Mon, May 11, 2020 at 5:24 PM Rob Clark wrote: > > On Mon, May 11, 2020 at 2:36 AM Daniel Vetter wrote: > > > > I honestly don't exactly understand what's going on here, but the > > current code is wrong for sure: It calls dma_buf_vunmap without ever > > calling dma_buf_vmap. > > > > What I'm not sure about is whether the WARN_ON is correct: > > - msm imports dma-buf using drm_prime_sg_to_page_addr_arrays. Which is > > a pretty neat layering violation of how you shouldn't peek behind > > the curtain of the dma-buf exporter, but par for course. Note that > > all the nice new helpers don't (and we should probably have a bit a > > warning about this in the kerneldoc). > > > > - but then in the get_vaddr() in msm_gem.c, and that seems to happily > > wrap a vmap() around any object with ->pages set (so including > > imported dma-buf) > > > > - I'm not seeing any guarantees that userspace can't use an imported > > dma-buf for e.g. MSM_SUBMIT_CMD_BUF in a5xx_submit_in_rb, so no > > guarantees that an imported dma-buf won't end up with a ->vaddr set. > > fwiw, a5xx_submit_in_rb() isn't a "normal" path (build-time disabled > by default, and restricted to sudo).. it really only exists to > simplify poking at fw. > > There could be vmap's in the msm_gem_submit path, however. If we > don't, we should probably just disallow using an imported dma-buf as > cmdstream.. I don't think there is any sane reason to permit that. We > should probably also disallow get_vaddr() on imported buffers. Yeah if that's possible and won't blow up (I can't test) I think it'd be best. Something like if (bo->import_attach) return NULL; should do the trick I think. Should I type that up as v2 of this? -Daniel > > BR, > -R > > > > > But even if that WARN_ON is wrong, cleaning up a vmap() done by msm by > > calling dma_buf_vmap is the wrong thing to do. > > > > Signed-off-by: Daniel Vetter > > Cc: Rob Clark > > Cc: Sean Paul > > Cc: linux-arm-msm@vger.kernel.org > > Cc: freedreno@lists.freedesktop.org > > --- > > drivers/gpu/drm/msm/msm_gem.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c > > index 5a6a79fbc9d6..3305a457960e 100644 > > --- a/drivers/gpu/drm/msm/msm_gem.c > > +++ b/drivers/gpu/drm/msm/msm_gem.c > > @@ -907,8 +907,7 @@ static void free_object(struct msm_gem_object *msm_obj) > > put_iova(obj); > > > > if (obj->import_attach) { > > - if (msm_obj->vaddr) > > - dma_buf_vunmap(obj->import_attach->dmabuf, msm_obj->vaddr); > > + WARN_ON(msm_obj->vaddr); > > > > /* Don't drop the pages for imported dmabuf, as they are not > > * ours, just free the array we allocated: > > -- > > 2.26.2 > > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx