From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerome Glisse Subject: Re: Why do flush page cache twice when change TT's cache attribute Date: Mon, 19 Mar 2012 13:22:16 -0400 Message-ID: <1332177736.2986.3.camel@localhost.localdomain> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-yx0-f177.google.com (mail-yx0-f177.google.com [209.85.213.177]) by gabe.freedesktop.org (Postfix) with ESMTP id B1D089ED77 for ; Mon, 19 Mar 2012 10:22:21 -0700 (PDT) Received: by yenm10 with SMTP id m10so6412983yen.36 for ; Mon, 19 Mar 2012 10:22:21 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Scott Fang Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Mon, 2012-03-19 at 23:11 +0800, Scott Fang wrote: > In function ttm_tt_set_caching > ,,,,,,, > > if (ttm->caching_state == tt_cached) > drm_clflush_pages(ttm->pages, ttm->num_pages); > > for (i = 0; i < ttm->num_pages; ++i) { > cur_page = ttm->pages[i]; > if (likely(cur_page != NULL)) { > ret = ttm_tt_set_page_caching(cur_page, > ttm->caching_state, > c_state); > if (unlikely(ret != 0)) > goto out_err; > } > } > > ttm->caching_state = c_state; > > return 0; > > > drm_clflush_pages flush cache one time. > then in the following function > ttm_tt_set_page_caching->set_memory_wc->change_page_attr_set: in this > function may flush page cache again. > > Does the code do some abundant flush, or there is some trick to these > codes? > > Thanks for the answer in advance. Yes there might be redundant flushing. Cheers, Jerome