dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	dri-devel@lists.freedesktop.org, ray.huang@amd.com
Cc: kbuild-all@lists.01.org, lkp@intel.com
Subject: Re: [PATCH 2/3] drm/ttm: remove swap LRU
Date: Thu, 11 Feb 2021 13:45:11 +0300	[thread overview]
Message-ID: <20210211104511.GF2696@kadam> (raw)
In-Reply-To: <20210210152114.1134-2-christian.koenig@amd.com>

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

Hi "Christian,

url:    https://github.com/0day-ci/linux/commits/Christian-K-nig/drm-ttm-move-swapout-logic-around/20210210-232812
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: ia64-randconfig-m031-20210209 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/gpu/drm/ttm/ttm_device.c:144 ttm_device_swapout() warn: variable dereferenced before check 'bo->ttm' (see line 142)

vim +144 drivers/gpu/drm/ttm/ttm_device.c

d37e3072dc32c7 Christian König 2021-02-10  125  long ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
d37e3072dc32c7 Christian König 2021-02-10  126  			gfp_t gfp_flags)
d37e3072dc32c7 Christian König 2021-02-10  127  {
d37e3072dc32c7 Christian König 2021-02-10  128  	struct ttm_global *glob = &ttm_glob;
d37e3072dc32c7 Christian König 2021-02-10  129  	struct ttm_resource_manager *man;
22b09b650f7486 Christian König 2021-02-10  130  	struct ttm_buffer_object *bo;
d37e3072dc32c7 Christian König 2021-02-10  131  	unsigned i, j;
22b09b650f7486 Christian König 2021-02-10  132  	int ret;
22b09b650f7486 Christian König 2021-02-10  133  
22b09b650f7486 Christian König 2021-02-10  134  	spin_lock(&glob->lru_lock);
d37e3072dc32c7 Christian König 2021-02-10  135  	for (i = TTM_PL_SYSTEM; i < TTM_NUM_MEM_TYPES; ++i) {
d37e3072dc32c7 Christian König 2021-02-10  136  		man = ttm_manager_type(bdev, i);
d37e3072dc32c7 Christian König 2021-02-10  137  		if (!man || !man->use_tt)
d37e3072dc32c7 Christian König 2021-02-10  138  			continue;
d37e3072dc32c7 Christian König 2021-02-10  139  
d37e3072dc32c7 Christian König 2021-02-10  140  		for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) {
d37e3072dc32c7 Christian König 2021-02-10  141  			list_for_each_entry(bo, &man->lru[j], lru) {
d37e3072dc32c7 Christian König 2021-02-10 @142  				long num_pages = bo->ttm->num_pages;
                                                                                                 ^^^^^^^^^
Dereferenced

d37e3072dc32c7 Christian König 2021-02-10  143  
d37e3072dc32c7 Christian König 2021-02-10 @144  				if (!bo->ttm ||
                                                                                    ^^^^^^^^
Checked too late

d37e3072dc32c7 Christian König 2021-02-10  145  				    bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
d37e3072dc32c7 Christian König 2021-02-10  146  				    bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)
d37e3072dc32c7 Christian König 2021-02-10  147  					continue;
22b09b650f7486 Christian König 2021-02-10  148  
22b09b650f7486 Christian König 2021-02-10  149  				ret = ttm_bo_swapout(bo, ctx, gfp_flags);
22b09b650f7486 Christian König 2021-02-10  150  				/* ttm_bo_swapout has dropped the lru_lock */
22b09b650f7486 Christian König 2021-02-10  151  				if (!ret)
22b09b650f7486 Christian König 2021-02-10  152  					return num_pages;
22b09b650f7486 Christian König 2021-02-10  153  				if (ret != -EBUSY)
22b09b650f7486 Christian König 2021-02-10  154  					return ret;
22b09b650f7486 Christian König 2021-02-10  155  			}
22b09b650f7486 Christian König 2021-02-10  156  		}
d37e3072dc32c7 Christian König 2021-02-10  157  	}
22b09b650f7486 Christian König 2021-02-10  158  	spin_unlock(&glob->lru_lock);
22b09b650f7486 Christian König 2021-02-10  159  	return 0;
22b09b650f7486 Christian König 2021-02-10  160  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31987 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

  reply	other threads:[~2021-02-11 10:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 15:21 [PATCH 1/3] drm/ttm: move swapout logic around Christian König
2021-02-10 15:21 ` [PATCH 2/3] drm/ttm: remove swap LRU Christian König
2021-02-11 10:45   ` Dan Carpenter [this message]
2021-02-13  2:53   ` kernel test robot
2021-02-10 15:21 ` [PATCH 3/3] drm/ttm: switch to per device LRU lock Christian König

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=20210211104511.GF2696@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=lkp@intel.com \
    --cc=ray.huang@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox