public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* questions about ttm_page_alloc.c
@ 2010-07-12 22:39 Dan Carpenter
  2010-07-12 23:12 ` Jerome Glisse
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2010-07-12 22:39 UTC (permalink / raw)
  To: suokkos; +Cc: dri-devel, linux-kernel

I'm investigating: https://bugzilla.kernel.org/show_bug.cgi?id=16337

He is using the new radeon with the new ttm pool wc/uc page allocator.
I'm sort of over my head when it comes to mm stuff so forgive me if
these are dumb questions...  I'm looking at 
drivers/gpu/drm/ttm/ttm_page_alloc.c.

   230  static int set_pages_array_wc(struct page **pages, int addrinarray)
   231  {
   232  #ifdef TTM_HAS_AGP
   233          int i;
   234  
   235          for (i = 0; i < addrinarray; i++)
   236                  map_page_into_agp(pages[i]);
			^^^^^^^^^^^^^^^^^^^^^^^^^^^

	This actually sets the pages to uncached and not to write
	cached.  Is that deliberate?

   237  #endif
   238          return 0;
   239  }

[snip]

   327                  pages_to_free[freed_pages++] = p;
   328                  /* We can only remove NUM_PAGES_TO_ALLOC at a time. */
   329                  if (freed_pages >= NUM_PAGES_TO_ALLOC) {
   330                          /* remove range of pages from the pool */
   331                          __list_del(p->lru.prev, &pool->list);

	Why do we use p->lru.prev here when we use &p->lru in other
	places?

   332  
   333                          ttm_pool_update_free_locked(pool, freed_pages);
   334                          /**
   335                           * Because changing page caching is costly
   336                           * we unlock the pool to prevent stalling.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: questions about ttm_page_alloc.c
  2010-07-12 22:39 questions about ttm_page_alloc.c Dan Carpenter
@ 2010-07-12 23:12 ` Jerome Glisse
  2010-07-22 11:56   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Jerome Glisse @ 2010-07-12 23:12 UTC (permalink / raw)
  To: Dan Carpenter, suokkos, dri-devel, linux-kernel

On 07/12/2010 06:39 PM, Dan Carpenter wrote:
> I'm investigating: https://bugzilla.kernel.org/show_bug.cgi?id=16337
>
> He is using the new radeon with the new ttm pool wc/uc page allocator.
> I'm sort of over my head when it comes to mm stuff so forgive me if
> these are dumb questions...  I'm looking at
> drivers/gpu/drm/ttm/ttm_page_alloc.c.
>
>     230  static int set_pages_array_wc(struct page **pages, int addrinarray)
>     231  {
>     232  #ifdef TTM_HAS_AGP
>     233          int i;
>     234
>     235          for (i = 0; i<  addrinarray; i++)
>     236                  map_page_into_agp(pages[i]);
> 			^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> 	This actually sets the pages to uncached and not to write
> 	cached.  Is that deliberate?
>
>     237  #endif
>     238          return 0;
>     239  }
>
> [snip]
>
>     327                  pages_to_free[freed_pages++] = p;
>     328                  /* We can only remove NUM_PAGES_TO_ALLOC at a time. */
>     329                  if (freed_pages>= NUM_PAGES_TO_ALLOC) {
>     330                          /* remove range of pages from the pool */
>     331                          __list_del(p->lru.prev,&pool->list);
>
> 	Why do we use p->lru.prev here when we use&p->lru in other
> 	places?
>
>     332
>     333                          ttm_pool_update_free_locked(pool, freed_pages);
>     334                          /**
>     335                           * Because changing page caching is costly
>     336                           * we unlock the pool to prevent stalling.
>
> regards,
> dan carpenter
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

No it's fine, this code is for non x86 CPU, and on such platform
we assume wc == uncached and wb is normal (ie cached).

Cheers,
Jerome

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: questions about ttm_page_alloc.c
  2010-07-12 23:12 ` Jerome Glisse
@ 2010-07-22 11:56   ` Dan Carpenter
  2010-07-22 14:10     ` Jerome Glisse
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2010-07-22 11:56 UTC (permalink / raw)
  To: Jerome Glisse; +Cc: suokkos, dri-devel, linux-kernel

On Mon, Jul 12, 2010 at 07:12:37PM -0400, Jerome Glisse wrote:
> On 07/12/2010 06:39 PM, Dan Carpenter wrote:
>>     327                  pages_to_free[freed_pages++] = p;
>>     328                  /* We can only remove NUM_PAGES_TO_ALLOC at a time. */
>>     329                  if (freed_pages>= NUM_PAGES_TO_ALLOC) {
>>     330                          /* remove range of pages from the pool */
>>     331                          __list_del(p->lru.prev,&pool->list);
>>
>> 	Why do we use p->lru.prev here when we use &p->lru in other
>> 	places?
>>
>>     332
>>     333                          ttm_pool_update_free_locked(pool, freed_pages);
>>     334                          /**
>>     335                           * Because changing page caching is costly
>>     336                           * we unlock the pool to prevent stalling.
>>

Thanks for answering about the wb vs uncached, but I'm still confused why we use
&p->lru in most places and p->lru.prev in this place.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: questions about ttm_page_alloc.c
  2010-07-22 11:56   ` Dan Carpenter
@ 2010-07-22 14:10     ` Jerome Glisse
  0 siblings, 0 replies; 4+ messages in thread
From: Jerome Glisse @ 2010-07-22 14:10 UTC (permalink / raw)
  To: Dan Carpenter, suokkos, dri-devel, linux-kernel

On 07/22/2010 07:56 AM, Dan Carpenter wrote:
> On Mon, Jul 12, 2010 at 07:12:37PM -0400, Jerome Glisse wrote:
>> On 07/12/2010 06:39 PM, Dan Carpenter wrote:
>>>      327                  pages_to_free[freed_pages++] = p;
>>>      328                  /* We can only remove NUM_PAGES_TO_ALLOC at a time. */
>>>      329                  if (freed_pages>= NUM_PAGES_TO_ALLOC) {
>>>      330                          /* remove range of pages from the pool */
>>>      331                          __list_del(p->lru.prev,&pool->list);
>>>
>>> 	Why do we use p->lru.prev here when we use&p->lru in other
>>> 	places?
>>>
>>>      332
>>>      333                          ttm_pool_update_free_locked(pool, freed_pages);
>>>      334                          /**
>>>      335                           * Because changing page caching is costly
>>>      336                           * we unlock the pool to prevent stalling.
>>>
>
> Thanks for answering about the wb vs uncached, but I'm still confused why we use
> &p->lru in most places and p->lru.prev in this place.
>
> regards,
> dan carpenter
>

This is because it use __list_del to remove a whole part of the list.

/*
  * Delete a list entry by making the prev/next entries
  * point to each other.
  *
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
static inline void __list_del(struct list_head * prev, struct list_head * next)
{
»·······next->prev = prev;
»·······prev->next = next;
}

Cheers,
Jerome

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-22 14:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-12 22:39 questions about ttm_page_alloc.c Dan Carpenter
2010-07-12 23:12 ` Jerome Glisse
2010-07-22 11:56   ` Dan Carpenter
2010-07-22 14:10     ` Jerome Glisse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox