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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 9BF73C47082 for ; Thu, 3 Jun 2021 18:42:18 +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 5BE0A613F3 for ; Thu, 3 Jun 2021 18:42:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BE0A613F3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com 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 0F9A46F4EB; Thu, 3 Jun 2021 18:42:16 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3118F6F4E3; Thu, 3 Jun 2021 18:42:14 +0000 (UTC) IronPort-SDR: PEZ4sZQQrx3WDu2p6b4UrMqZiPDzRd7egNnheCRENBJUJ6jPv4YTAOWOdkg0E15quhv1Lfudwg Foo0AQEmPz4Q== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="265287849" X-IronPort-AV: E=Sophos;i="5.83,246,1616482800"; d="scan'208";a="265287849" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 11:42:08 -0700 IronPort-SDR: 7b8N9DM8TFqBMmSaVTEoibMuMD4qRq2bLRhvvuoROdl4FnUZZQXGfse5aMjOBQJe3wg7StTE5V omsR23QyxeLg== X-IronPort-AV: E=Sophos;i="5.83,246,1616482800"; d="scan'208";a="480335484" Received: from aconradi-mobl1.ger.corp.intel.com (HELO intel.com) ([10.249.44.213]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 11:42:04 -0700 Date: Thu, 3 Jun 2021 21:42:00 +0300 From: Andi Shyti To: Daniel Vetter Message-ID: References: <20210603150326.1326658-1-daniel.vetter@ffwll.ch> <20210603150326.1326658-5-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210603150326.1326658-5-daniel.vetter@ffwll.ch> Subject: Re: [Intel-gfx] [PATCH v2 4/4] drm/vgem: use shmem helpers 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: Christian =?iso-8859-15?Q?K=F6nig?= , Intel Graphics Development , DRI Development , Chris Wilson , Melissa Wen , John Stultz , Thomas Zimmermann , Daniel Vetter , Sumit Semwal Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Hi Daniel, > +/* > + * This just sets wc mode for shmem helpers. vgem doesn't have any begin/end cpu > + * access ioctls, there must use coherent memory or dma-buf sharing just wont > + * work. > + */ > +static struct drm_gem_object *vgem_gem_create_object(struct drm_device *dev, size_t size) > { > - struct drm_vgem_gem_object *obj; > - int npages; > + struct drm_gem_shmem_object *obj; > > - obj = __vgem_gem_create(dev, attach->dmabuf->size); > - if (IS_ERR(obj)) > - return ERR_CAST(obj); > - > - npages = PAGE_ALIGN(attach->dmabuf->size) / PAGE_SIZE; > + obj = kzalloc(sizeof(*obj), GFP_KERNEL); > + if (!obj) > + return NULL; > > - obj->table = sg; > - obj->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL); > - if (!obj->pages) { > - __vgem_gem_destroy(obj); > - return ERR_PTR(-ENOMEM); > - } > + obj->base.funcs = &drm_gem_shmem_funcs; > + obj->map_wc = true; > > - obj->pages_pin_count++; /* perma-pinned */ > - drm_prime_sg_to_page_array(obj->table, obj->pages, npages); > return &obj->base; here you are allocating a bigger object than what you are returning, in size. How does it get freed? Andi _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx