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>] [day] [month] [year] [list]
Message-ID: <20210121122410.1b804d28@canb.auug.org.au>
Date:   Thu, 21 Jan 2021 12:24:10 +1100
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     Daniel Vetter <daniel.vetter@...ll.ch>,
        Intel Graphics <intel-gfx@...ts.freedesktop.org>,
        DRI <dri-devel@...ts.freedesktop.org>
Cc:     Christian König <christian.koenig@....com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>
Subject: linux-next: manual merge of the drm-misc tree with Linus' tree

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);

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ