lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190807072654.arqvx37p4yxhegcu@sirius.home.kraxel.org>
Date:   Wed, 7 Aug 2019 09:26:54 +0200
From:   Gerd Hoffmann <kraxel@...hat.com>
To:     dri-devel@...ts.freedesktop.org, tzimmermann@...e.de,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] drm: add gem ttm helpers

> > +/**
> > + * drm_gem_ttm_mmap_offset() - Returns a GEM ttm object's mmap offset
> > + * @gbo:	the GEM ttm object
> > + *
> > + * See drm_vma_node_offset_addr() for more information.
> > + *
> > + * Returns:
> > + * The buffer object's offset for userspace mappings on success, or
> > + * 0 if no offset is allocated.
> > + */
> > +u64 drm_gem_ttm_mmap_offset(struct ttm_buffer_object *bo)
> > +{
> > +	return drm_vma_node_offset_addr(&bo->base.vma_node);
> 
> Why do we need a new one here, can't we use the existing gem
> implementation for this (there really should only be one I hope, but I
> didn't check).

Havn't found one.

But maybe we don't need this as separate function and can simply move
the drm_vma_node_offset_addr() call into
drm_gem_ttm_driver_dumb_mmap_offset().

> > +int drm_gem_ttm_driver_dumb_mmap_offset(struct drm_file *file,
> > +					 struct drm_device *dev,
> > +					 uint32_t handle, uint64_t *offset)
> > +{
> > +	struct drm_gem_object *gem;
> > +	struct ttm_buffer_object *bo;
> > +
> > +	gem = drm_gem_object_lookup(file, handle);
> > +	if (!gem)
> > +		return -ENOENT;
> > +
> > +	bo = drm_gem_ttm_of_gem(gem);
> > +	*offset = drm_gem_ttm_mmap_offset(bo);
> > +
> > +	drm_gem_object_put_unlocked(gem);
> > +
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL(drm_gem_ttm_driver_dumb_mmap_offset);
> 
> Same for this, you're just upcasting to ttm_bo and then downcasting to
> gem_bo again ... I think just a series to roll out the existing gem
> helpers everywhere should work?

I don't think so.  drm_gem_dumb_map_offset() calls
drm_gem_create_mmap_offset(), which I think is not correct for ttm
objects because ttm_bo_init() handles vma_node initialization.

cheers,
  Gerd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ