All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Ørjan Eide" <orjan.eide@arm.com>
Cc: devel@driverdev.osuosl.org, "Laura Abbott" <labbott@redhat.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Lecopzer Chen" <lecopzer.chen@mediatek.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org,
	"Arve Hjønnevåg" <arve@android.com>,
	anders.pedersen@arm.com, "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Darren Hart (VMware)" <dvhart@infradead.org>,
	nd@arm.com, "Martijn Coenen" <maco@android.com>,
	"Christian Brauner" <christian@brauner.io>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] staging: android: ion: Skip sync if not mapped
Date: Thu, 16 Apr 2020 12:49:56 +0300	[thread overview]
Message-ID: <20200416094955.GM1163@kadam> (raw)
In-Reply-To: <20200414141849.55654-1-orjan.eide@arm.com>

On Tue, Apr 14, 2020 at 04:18:47PM +0200, Ørjan Eide wrote:
> @@ -238,6 +242,10 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment,
>  			      struct sg_table *table,
>  			      enum dma_data_direction direction)
>  {
> +	struct ion_dma_buf_attachment *a = attachment->priv;
> +
> +	a->mapped = false;

Possibly a stupid question but here we're not holding a lock.  Is
concurrency an issue?

> +
>  	dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction);
>  }
>  
> @@ -297,6 +305,8 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
>  
>  	mutex_lock(&buffer->lock);
>  	list_for_each_entry(a, &buffer->attachments, list) {
> +		if (!a->mapped)
> +			continue;
>  		dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
>  				    direction);
>  	}

regards,
dan carpenter


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Ørjan Eide" <orjan.eide@arm.com>
Cc: devel@driverdev.osuosl.org, nd@arm.com,
	"Todd Kjos" <tkjos@android.com>,
	"Lecopzer Chen" <lecopzer.chen@mediatek.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org,
	"Arve Hjønnevåg" <arve@android.com>,
	john.stultz@linaro.org, anders.pedersen@arm.com,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Darren Hart (VMware)" <dvhart@infradead.org>,
	"Laura Abbott" <labbott@redhat.com>,
	"Martijn Coenen" <maco@android.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian Brauner" <christian@brauner.io>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] staging: android: ion: Skip sync if not mapped
Date: Thu, 16 Apr 2020 12:49:56 +0300	[thread overview]
Message-ID: <20200416094955.GM1163@kadam> (raw)
In-Reply-To: <20200414141849.55654-1-orjan.eide@arm.com>

On Tue, Apr 14, 2020 at 04:18:47PM +0200, Ørjan Eide wrote:
> @@ -238,6 +242,10 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment,
>  			      struct sg_table *table,
>  			      enum dma_data_direction direction)
>  {
> +	struct ion_dma_buf_attachment *a = attachment->priv;
> +
> +	a->mapped = false;

Possibly a stupid question but here we're not holding a lock.  Is
concurrency an issue?

> +
>  	dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction);
>  }
>  
> @@ -297,6 +305,8 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
>  
>  	mutex_lock(&buffer->lock);
>  	list_for_each_entry(a, &buffer->attachments, list) {
> +		if (!a->mapped)
> +			continue;
>  		dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
>  				    direction);
>  	}

regards,
dan carpenter



  parent reply	other threads:[~2020-04-16  9:52 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 13:46 [PATCH] staging: android: ion: Skip sync if not mapped Ørjan Eide
2020-04-14 13:46 ` Ørjan Eide
2020-04-14 14:04 ` Greg Kroah-Hartman
2020-04-14 14:04   ` Greg Kroah-Hartman
2020-04-14 14:18 ` Ørjan Eide
2020-04-14 14:18   ` Ørjan Eide
2020-04-14 14:28   ` Greg Kroah-Hartman
2020-04-14 14:28     ` Greg Kroah-Hartman
2020-04-14 16:11     ` Ørjan Eide
2020-04-14 16:11       ` Ørjan Eide
2020-04-15  5:16       ` John Stultz
2020-04-15  5:16         ` John Stultz
2020-04-15  4:41     ` John Stultz
2020-04-15  4:41       ` John Stultz
2020-04-16 10:25       ` Greg Kroah-Hartman
2020-04-16 10:25         ` Greg Kroah-Hartman
2020-04-17 15:00         ` Daniel Vetter
2020-04-17 15:00           ` Daniel Vetter
2020-04-20  7:53           ` Christoph Hellwig
2020-04-20  8:22         ` Christian Brauner
2020-04-20  8:22           ` Christian Brauner
2020-04-20 20:03           ` John Stultz
2020-04-20 20:03             ` John Stultz
2020-04-21  8:05             ` Greg Kroah-Hartman
2020-04-21  8:05               ` Greg Kroah-Hartman
2020-07-03  7:04               ` Greg Kroah-Hartman
2020-07-03  7:04                 ` Greg Kroah-Hartman
2020-07-08  3:43                 ` John Stultz
2020-07-08  3:43                   ` John Stultz
2020-07-10 11:47                   ` Greg Kroah-Hartman
2020-07-10 11:47                     ` Greg Kroah-Hartman
2020-04-16  9:49   ` Dan Carpenter [this message]
2020-04-16  9:49     ` Dan Carpenter
2020-04-16 16:25     ` Ørjan Eide
2020-04-16 16:25       ` Ørjan Eide
2020-04-16 17:36       ` Dan Carpenter
2020-04-16 17:36         ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200416094955.GM1163@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=anders.pedersen@arm.com \
    --cc=arnd@arndb.de \
    --cc=arve@android.com \
    --cc=christian@brauner.io \
    --cc=daniel.vetter@ffwll.ch \
    --cc=devel@driverdev.osuosl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=dvhart@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=labbott@redhat.com \
    --cc=lecopzer.chen@mediatek.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=maco@android.com \
    --cc=nd@arm.com \
    --cc=orjan.eide@arm.com \
    --cc=tkjos@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.