Skip to contentSkip to conversation

drm/xe: Implement madvise ioctl for xe

bug report Dan Carpenter 1 participant 1 message Aug 28, 2025

lore
Share & tools
lore
#0 lore raw

Hello Himal Prasad Ghimiray,

Commit ada7486c5668 ("drm/xe: Implement madvise ioctl for xe") from Aug 21, 2025 (linux-next), leads to the following Smatch static checker warning:

	drivers/gpu/drm/xe/xe_vm_madvise.c:208 xe_zap_ptes_in_madvise_range()
	warn: inconsistent indenting

drivers/gpu/drm/xe/xe_vm_madvise.c

    189         drm_gpuvm_for_each_va_range(gpuva, &vm->gpuvm, start, end) {
    190                 struct xe_vma *vma = gpuva_to_vma(gpuva);
    191 
    192                 if (vma->skip_invalidation || xe_vma_is_null(vma))
    193                         continue;
    194 
    195                 if (xe_vma_is_cpu_addr_mirror(vma)) {
    196                         tile_mask |= xe_svm_ranges_zap_ptes_in_range(vm,
    197                                                                       xe_vma_start(vma),
    198                                                                       xe_vma_end(vma));
    199                 } else {
    200                         for_each_tile(tile, vm->xe, id) {
    201                                 if (xe_pt_zap_ptes(tile, vma)) {
                                                                      ^^

Adding this curly braces seems like a bug.

202 tile_mask |= BIT(id);
203
204 /*
205 * WRITE_ONCE pairs with READ_ONCE
206 * in xe_vm_has_valid_gpu_mapping()
207 */
--> 208 WRITE_ONCE(vma->tile_invalidated,

    209                                            vma->tile_invalidated | BIT(id));

It looks like the WRITE_ONCE() is not supposed to be part of the if statement.

    210                                 }
    211                         }
    212                 }
    213         }
    214 
    215         return tile_mask;
    216 }

regards,
dan carpenter