linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics <intel-gfx@lists.freedesktop.org>,
	DRI <dri-devel@lists.freedesktop.org>
Cc: "Christian König" <christian.koenig@amd.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Linux Next Mailing List" <linux-next@vger.kernel.org>
Subject: linux-next: manual merge of the drm-misc tree with Linus' tree
Date: Thu, 21 Jan 2021 12:24:10 +1100	[thread overview]
Message-ID: <20210121122410.1b804d28@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 5154 bytes --]

Hi all,

Today's linux-next merge of the drm-misc tree got a conflict in:

  drivers/gpu/drm/ttm/ttm_pool.c

between commit:

  bb52cb0dec8d ("drm/ttm: make the pool shrinker lock a mutex")

from Linus' tree and commits:

  ba051901d10f ("drm/ttm: add a debugfs file for the global page pools")
  f987c9e0f537 ("drm/ttm: optimize ttm pool shrinker a bit")

from the drm-misc tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/ttm/ttm_pool.c
index 11e0313db0ea,e0617717113f..000000000000
--- a/drivers/gpu/drm/ttm/ttm_pool.c
+++ b/drivers/gpu/drm/ttm/ttm_pool.c
@@@ -503,11 -505,14 +506,13 @@@ void ttm_pool_init(struct ttm_pool *poo
  	pool->use_dma_alloc = use_dma_alloc;
  	pool->use_dma32 = use_dma32;
  
- 	for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i)
- 		for (j = 0; j < MAX_ORDER; ++j)
- 			ttm_pool_type_init(&pool->caching[i].orders[j],
- 					   pool, i, j);
+ 	if (use_dma_alloc) {
+ 		for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i)
+ 			for (j = 0; j < MAX_ORDER; ++j)
+ 				ttm_pool_type_init(&pool->caching[i].orders[j],
+ 						   pool, i, j);
+ 	}
  }
 -EXPORT_SYMBOL(ttm_pool_init);
  
  /**
   * ttm_pool_fini - Cleanup a pool
@@@ -521,9 -526,34 +526,33 @@@ void ttm_pool_fini(struct ttm_pool *poo
  {
  	unsigned int i, j;
  
- 	for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i)
- 		for (j = 0; j < MAX_ORDER; ++j)
- 			ttm_pool_type_fini(&pool->caching[i].orders[j]);
+ 	if (pool->use_dma_alloc) {
+ 		for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i)
+ 			for (j = 0; j < MAX_ORDER; ++j)
+ 				ttm_pool_type_fini(&pool->caching[i].orders[j]);
+ 	}
+ }
 -EXPORT_SYMBOL(ttm_pool_fini);
+ 
+ /* As long as pages are available make sure to release at least one */
+ static unsigned long ttm_pool_shrinker_scan(struct shrinker *shrink,
+ 					    struct shrink_control *sc)
+ {
+ 	unsigned long num_freed = 0;
+ 
+ 	do
+ 		num_freed += ttm_pool_shrink();
+ 	while (!num_freed && atomic_long_read(&allocated_pages));
+ 
+ 	return num_freed;
+ }
+ 
+ /* Return the number of pages available or SHRINK_EMPTY if we have none */
+ static unsigned long ttm_pool_shrinker_count(struct shrinker *shrink,
+ 					     struct shrink_control *sc)
+ {
+ 	unsigned long num_pages = atomic_long_read(&allocated_pages);
+ 
+ 	return num_pages ? num_pages : SHRINK_EMPTY;
  }
  
  #ifdef CONFIG_DEBUG_FS
@@@ -553,6 -594,35 +593,35 @@@ static void ttm_pool_debugfs_orders(str
  	seq_puts(m, "\n");
  }
  
+ /* Dump the total amount of allocated pages */
+ static void ttm_pool_debugfs_footer(struct seq_file *m)
+ {
+ 	seq_printf(m, "\ntotal\t: %8lu of %8lu\n",
+ 		   atomic_long_read(&allocated_pages), page_pool_size);
+ }
+ 
+ /* Dump the information for the global pools */
+ static int ttm_pool_debugfs_globals_show(struct seq_file *m, void *data)
+ {
+ 	ttm_pool_debugfs_header(m);
+ 
 -	spin_lock(&shrinker_lock);
++	mutex_lock(&shrinker_lock);
+ 	seq_puts(m, "wc\t:");
+ 	ttm_pool_debugfs_orders(global_write_combined, m);
+ 	seq_puts(m, "uc\t:");
+ 	ttm_pool_debugfs_orders(global_uncached, m);
+ 	seq_puts(m, "wc 32\t:");
+ 	ttm_pool_debugfs_orders(global_dma32_write_combined, m);
+ 	seq_puts(m, "uc 32\t:");
+ 	ttm_pool_debugfs_orders(global_dma32_uncached, m);
 -	spin_unlock(&shrinker_lock);
++	mutex_unlock(&shrinker_lock);
+ 
+ 	ttm_pool_debugfs_footer(m);
+ 
+ 	return 0;
+ }
+ DEFINE_SHOW_ATTRIBUTE(ttm_pool_debugfs_globals);
+ 
  /**
   * ttm_pool_debugfs - Debugfs dump function for a pool
   *
@@@ -565,23 -635,14 +634,14 @@@ int ttm_pool_debugfs(struct ttm_pool *p
  {
  	unsigned int i;
  
- 	mutex_lock(&shrinker_lock);
- 
- 	seq_puts(m, "\t ");
- 	for (i = 0; i < MAX_ORDER; ++i)
- 		seq_printf(m, " ---%2u---", i);
- 	seq_puts(m, "\n");
- 
- 	seq_puts(m, "wc\t:");
- 	ttm_pool_debugfs_orders(global_write_combined, m);
- 	seq_puts(m, "uc\t:");
- 	ttm_pool_debugfs_orders(global_uncached, m);
+ 	if (!pool->use_dma_alloc) {
+ 		seq_puts(m, "unused\n");
+ 		return 0;
+ 	}
  
- 	seq_puts(m, "wc 32\t:");
- 	ttm_pool_debugfs_orders(global_dma32_write_combined, m);
- 	seq_puts(m, "uc 32\t:");
- 	ttm_pool_debugfs_orders(global_dma32_uncached, m);
+ 	ttm_pool_debugfs_header(m);
  
 -	spin_lock(&shrinker_lock);
++	mutex_lock(&shrinker_lock);
  	for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) {
  		seq_puts(m, "DMA ");
  		switch (i) {
@@@ -597,12 -658,9 +657,9 @@@
  		}
  		ttm_pool_debugfs_orders(pool->caching[i].orders, m);
  	}
- 
- 	seq_printf(m, "\ntotal\t: %8lu of %8lu\n",
- 		   atomic_long_read(&allocated_pages), page_pool_size);
- 
 -	spin_unlock(&shrinker_lock);
 +	mutex_unlock(&shrinker_lock);
  
+ 	ttm_pool_debugfs_footer(m);
  	return 0;
  }
  EXPORT_SYMBOL(ttm_pool_debugfs);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2021-01-21  2:09 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21  1:24 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-25 23:29 linux-next: manual merge of the drm-misc tree with Linus' tree Stephen Rothwell
2024-02-06  0:59 Stephen Rothwell
2024-02-06  1:06 ` Stephen Rothwell
2024-02-06 11:28   ` Michael Walle
2024-02-06 11:34     ` Dario Binacchi
2023-11-14  0:42 Stephen Rothwell
2023-11-14  0:36 Stephen Rothwell
2023-11-14  0:31 Stephen Rothwell
2023-11-14  0:25 Stephen Rothwell
2023-09-25  1:41 Stephen Rothwell
2023-09-20  1:12 Stephen Rothwell
2023-09-13  1:09 Stephen Rothwell
2023-09-13  9:04 ` Uwe Kleine-König
2023-07-12 23:58 Stephen Rothwell
2023-05-23  0:43 Stephen Rothwell
2023-05-15  1:14 Stephen Rothwell
2023-03-14  0:19 Stephen Rothwell
2023-01-19  1:13 Stephen Rothwell
2023-01-05 23:50 Stephen Rothwell
2022-11-03 23:15 Stephen Rothwell
2022-10-05  0:43 Stephen Rothwell
2022-06-29  1:06 Stephen Rothwell
2022-06-10  0:44 Stephen Rothwell
2021-11-16 22:29 Stephen Rothwell
2021-10-28  2:48 Stephen Rothwell
2020-10-27  1:26 Stephen Rothwell
2020-10-27  1:20 Stephen Rothwell
2020-10-27  1:16 Stephen Rothwell
2020-08-26  0:01 Stephen Rothwell
2020-09-02  3:11 ` Stephen Rothwell
2020-06-29  1:14 Stephen Rothwell
2020-06-26  1:43 Stephen Rothwell
2020-06-17  0:46 Stephen Rothwell
2020-04-16  1:25 Stephen Rothwell
2020-04-15  1:46 Stephen Rothwell
2019-12-16  0:51 Stephen Rothwell
2019-12-16  0:46 Stephen Rothwell
2019-05-21  0:51 Stephen Rothwell
2019-05-23  0:27 ` Stephen Rothwell
2019-05-23  8:10 ` Maxime Ripard
2019-05-23  9:34   ` Stephen Rothwell
2019-05-23 11:53 ` Maxime Ripard
2019-05-23 13:04   ` Stephen Rothwell
2019-05-23 13:11     ` Daniel Vetter
2019-05-23 14:16       ` Stephen Rothwell
2019-05-23 16:10   ` Rob Herring
2019-05-24  7:12     ` Maxime Ripard
2019-01-11  0:14 Stephen Rothwell
2018-03-20  1:08 Stephen Rothwell
2018-03-23  0:43 ` Stephen Rothwell
2018-03-15  3:14 Stephen Rothwell
2018-03-23  0:45 ` Stephen Rothwell
2017-09-22  2:24 Stephen Rothwell
2017-08-02  2:23 Stephen Rothwell
2017-08-10  2:06 ` Stephen Rothwell
2017-07-19  1:30 Stephen Rothwell
2016-09-23  1:35 Stephen Rothwell
2016-06-07  1:32 Stephen Rothwell
2016-03-31  0:15 Stephen Rothwell
2016-03-29 23:49 Stephen Rothwell
2015-12-16  0:38 Stephen Rothwell
2015-12-14  1:12 Stephen Rothwell
2015-12-14  7:09 ` Thomas Hellstrom
2015-09-12  3:15 Stephen Rothwell
2015-08-14  2:06 Stephen Rothwell
2015-08-03  2:11 Stephen Rothwell
2015-07-30  3:04 Stephen Rothwell

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=20210121122410.1b804d28@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).