== Series Details == Series: drm/i915: Interface to get GFX shmem usage stats per process URL : https://patchwork.freedesktop.org/series/40464/ State : warning == Summary == $ dim checkpatch origin/drm-tip a2507d62bb4c drm/i915: Sysfs interface to get GFX shmem usage stats per process -:228: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV) #228: FILE: drivers/gpu/drm/i915/i915_gem.c:6118: + if (res > 0 && buffer[res-1] != '\0' && len < PAGE_SIZE) ^ -:229: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV) #229: FILE: drivers/gpu/drm/i915/i915_gem.c:6119: + buffer[res-1] = '\0'; ^ -:275: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!entry" #275: FILE: drivers/gpu/drm/i915/i915_gem.c:6165: + if (entry == NULL) { -:315: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #315: FILE: drivers/gpu/drm/i915/i915_gem.c:6205: + DRM_DEBUG("Couldn't find matching tgid %d for obj %p\n", + current_tgid, obj); -:329: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #329: FILE: drivers/gpu/drm/i915/i915_gem.c:6219: +static int i915_obj_find_insert_in_hash(struct drm_i915_gem_object *obj, + struct pid_stat_entry *pid_entry, -:336: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #336: FILE: drivers/gpu/drm/i915/i915_gem.c:6226: + ret = drm_ht_find_item(&pid_entry->namelist, + (unsigned long)&obj->base, &hash_item); -:338: CHECK:BRACES: braces {} should be used on all arms of this statement #338: FILE: drivers/gpu/drm/i915/i915_gem.c:6228: + if (ret) { [...] + } else [...] -:341: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!entry" #341: FILE: drivers/gpu/drm/i915/i915_gem.c:6231: + if (entry == NULL) { -:350: CHECK:BRACES: Unbalanced braces around else statement #350: FILE: drivers/gpu/drm/i915/i915_gem.c:6240: + } else -:357: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #357: FILE: drivers/gpu/drm/i915/i915_gem.c:6247: +static int i915_obj_shared_count(struct drm_i915_gem_object *obj, + struct pid_stat_entry *pid_entry, -:371: CHECK:BRACES: braces {} should be used on all arms of this statement #371: FILE: drivers/gpu/drm/i915/i915_gem.c:6261: + if (!obj->base.name && !obj->base.dma_buf) [...] + else if (obj->base.import_attach) { [...] -:429: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #429: FILE: drivers/gpu/drm/i915/i915_gem.c:6319: + i915_obj_get_shmem_pages_alloced(obj)*PAGE_SIZE; ^ -:439: CHECK:BRACES: braces {} should be used on all arms of this statement #439: FILE: drivers/gpu/drm/i915/i915_gem.c:6329: + if (obj_shared_count > 1) { [...] + } else [...] -:443: CHECK:BRACES: Unbalanced braces around else statement #443: FILE: drivers/gpu/drm/i915/i915_gem.c:6333: + } else -:480: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!new_entry" #480: FILE: drivers/gpu/drm/i915/i915_gem.c:6370: + if (new_entry == NULL) { -:490: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #490: FILE: drivers/gpu/drm/i915/i915_gem.c:6380: + ret = drm_ht_create(&new_entry->namelist, + DRM_DEBUG_MAGIC_HASH_ORDER); -:519: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #519: FILE: drivers/gpu/drm/i915/i915_gem.c:6409: + + } -:541: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #541: FILE: drivers/gpu/drm/i915/i915_gem.c:6431: + err_puts(m, + "\n\n pid Total Shared Priv Purgeable Alloced SharedPHYsize SharedPHYprop PrivPHYsize PurgeablePHYsize process\n"); -:561: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #561: FILE: drivers/gpu/drm/i915/i915_gem.c:6451: + list_for_each_entry_safe(new_pid_entry, new_temp_entry, + &sorted_pid_stats, head) { -:567: WARNING:MULTILINE_DEREFERENCE: Avoid multiple line dereference - prefer 'new_pid_entry->stats.phys_space_shared_proportion' #567: FILE: drivers/gpu/drm/i915/i915_gem.c:6457: + new_pid_entry-> + stats.phys_space_shared_proportion + -:572: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #572: FILE: drivers/gpu/drm/i915/i915_gem.c:6462: + list_add_tail(&pid_entry->head, + &new_pid_entry->head); -:576: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #576: FILE: drivers/gpu/drm/i915/i915_gem.c:6466: + if (list_is_last(&new_pid_entry->head, + &sorted_pid_stats)) { -:579: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #579: FILE: drivers/gpu/drm/i915/i915_gem.c:6469: + list_add_tail(&pid_entry->head, + &sorted_pid_stats); -:585: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #585: FILE: drivers/gpu/drm/i915/i915_gem.c:6475: + list_for_each_entry_safe(pid_entry, temp_entry, + &sorted_pid_stats, head) { -:589: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #589: FILE: drivers/gpu/drm/i915/i915_gem.c:6479: + err_printf(m, + "%5d %6d %6d %6d %9d %8d %14zdK %14zdK %14zdK %14zdK %s", -:596: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #596: FILE: drivers/gpu/drm/i915/i915_gem.c:6486: + pid_entry->stats.phys_space_allocated_shared/1024, ^ -:597: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #597: FILE: drivers/gpu/drm/i915/i915_gem.c:6487: + pid_entry->stats.phys_space_shared_proportion/1024, ^ -:598: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #598: FILE: drivers/gpu/drm/i915/i915_gem.c:6488: + pid_entry->stats.phys_space_allocated_priv/1024, ^ -:599: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #599: FILE: drivers/gpu/drm/i915/i915_gem.c:6489: + pid_entry->stats.phys_space_purgeable/1024, ^ -:602: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!task" #602: FILE: drivers/gpu/drm/i915/i915_gem.c:6492: + if (task == NULL) -:608: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #608: FILE: drivers/gpu/drm/i915/i915_gem.c:6498: + pid_entry->stats.phys_space_shared_proportion/1024; ^ -:610: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #610: FILE: drivers/gpu/drm/i915/i915_gem.c:6500: + pid_entry->stats.phys_space_allocated_priv/1024; ^ -:614: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #614: FILE: drivers/gpu/drm/i915/i915_gem.c:6504: + list_for_each_entry_safe(entry, next, + &pid_entry->namefree, head) { -:617: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #617: FILE: drivers/gpu/drm/i915/i915_gem.c:6507: + drm_ht_remove_item(&pid_entry->namelist, + &entry->hash_item); -:628: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #628: FILE: drivers/gpu/drm/i915/i915_gem.c:6518: + err_puts(m, + "\t\t\t\t\t\t\t\t--------------\t-------------\t--------\n"); -:630: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #630: FILE: drivers/gpu/drm/i915/i915_gem.c:6520: + err_printf(m, + "\t\t\t\t\t\t\t\t%13zdK\t%12zdK\tTotal\n", -:754: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #754: FILE: drivers/gpu/drm/i915/i915_sysfs.c:555: } +static ssize_t i915_gem_clients_state_read(struct file *filp, -:755: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #755: FILE: drivers/gpu/drm/i915/i915_sysfs.c:556: +static ssize_t i915_gem_clients_state_read(struct file *filp, + struct kobject *memtrack_kobj, -:791: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #791: FILE: drivers/gpu/drm/i915/i915_sysfs.c:593: }; +static struct bin_attribute i915_gem_client_state_attr = { -:793: WARNING:SYMBOLIC_PERMS: Symbolic permissions 'S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH' are not preferred. Consider using octal permissions '0644'. #793: FILE: drivers/gpu/drm/i915/i915_sysfs.c:595: + .attr.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, -:819: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #819: FILE: drivers/gpu/drm/i915/i915_sysfs.c:621: + ret = kobject_init_and_add( -:823: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #823: FILE: drivers/gpu/drm/i915/i915_sysfs.c:625: + DRM_ERROR( -:829: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #829: FILE: drivers/gpu/drm/i915/i915_sysfs.c:631: + ret = sysfs_create_bin_file(&dev_priv->memtrack_kobj, + &i915_gem_client_state_attr); -:831: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #831: FILE: drivers/gpu/drm/i915/i915_sysfs.c:633: + DRM_ERROR( -:847: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #847: FILE: drivers/gpu/drm/i915/i915_sysfs.c:718: + sysfs_remove_bin_file(&dev_priv->memtrack_kobj, + &i915_gem_client_state_attr); total: 0 errors, 2 warnings, 43 checks, 766 lines checked 27bfa55dd165 drm/i915: Calculate total shmem GFX memory consumed -:84: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'obj->has_backing_pages == 1' #84: FILE: drivers/gpu/drm/i915/i915_gem.c:4884: + if (!obj->stolen && (obj->has_backing_pages == 1)) { -:126: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #126: FILE: drivers/gpu/drm/i915/i915_gem.c:6554: + err_printf(m, "\nTotal used GFX Shmem Physical space %8zdK\n", + dev_priv->mm.phys_mem_total/1024); -:126: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #126: FILE: drivers/gpu/drm/i915/i915_gem.c:6554: + dev_priv->mm.phys_mem_total/1024); ^ total: 0 errors, 0 warnings, 3 checks, 101 lines checked 0d8d278defab drm/i915: Sysfs interface to get detailed GFX buffer info per process -:167: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!client_pid" #167: FILE: drivers/gpu/drm/i915/i915_gem.c:3689: + if (client_pid == NULL) { -:175: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #175: FILE: drivers/gpu/drm/i915/i915_gem.c:3697: + ret = i915_gem_create_sysfs_file_entry(&i915->drm, + &client_pid->obj_attr); -:187: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #187: FILE: drivers/gpu/drm/i915/i915_gem.c:3709: + + } -:201: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'client_pid->tgid == tgid' #201: FILE: drivers/gpu/drm/i915/i915_gem.c:3723: + if ((client_pid->tgid == tgid) && + (--client_pid->open_obj_count == 0)) { -:249: CHECK:LINE_SPACING: Please don't use multiple blank lines #249: FILE: drivers/gpu/drm/i915/i915_gem.c:3790: + -:322: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #322: FILE: drivers/gpu/drm/i915/i915_gem.c:6436: + nr_bytes = i915_obj_get_shmem_pages_alloced(obj)*PAGE_SIZE; ^ -:324: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'obj->mm.madv != __I915_MADV_PURGED' #324: FILE: drivers/gpu/drm/i915/i915_gem.c:6438: + if (!discard && !obj->stolen && + (obj->mm.madv != __I915_MADV_PURGED) && + (nr_bytes != 0)) { -:324: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'nr_bytes != 0' #324: FILE: drivers/gpu/drm/i915/i915_gem.c:6438: + if (!discard && !obj->stolen && + (obj->mm.madv != __I915_MADV_PURGED) && + (nr_bytes != 0)) { -:325: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #325: FILE: drivers/gpu/drm/i915/i915_gem.c:6439: + if (!discard && !obj->stolen && + (obj->mm.madv != __I915_MADV_PURGED) && -:335: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #335: FILE: drivers/gpu/drm/i915/i915_gem.c:6449: + i915_error_printf(m, + "%p: %7zdK %10zdK %c %c %s %s %s %s %s", -:368: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #368: FILE: drivers/gpu/drm/i915/i915_gem.c:6482: + i915_error_printf(m, " (%d: %d)", + pid_info_entry->tgid, -:389: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #389: FILE: drivers/gpu/drm/i915/i915_gem.c:6503: + list_for_each_entry(pid_info, &obj->pid_info, head) { + -:435: CHECK:CONCATENATED_STRING: Concatenated strings should use spaces between elements #435: FILE: drivers/gpu/drm/i915/i915_gem.c:6792: + i915_error_printf(m, "%"SPACES_STR(NUM_SPACES)"s\n", " "); -:438: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #438: FILE: drivers/gpu/drm/i915/i915_gem.c:6795: + err_puts(m, + "\n Obj Identifier Obj-Size Resident-Size Pin Tiling Dirty Shared Vmap Stolen Mappable AllocState Global/PP GttOffset (PID: handle count)\n"); -:448: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #448: FILE: drivers/gpu/drm/i915/i915_gem.c:6805: + ret = idr_for_each(&file->object_idr, + &i915_drm_gem_obj_info, &obj_stat_buf); -:460: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #460: FILE: drivers/gpu/drm/i915/i915_gem.c:6817: + i915_error_printf(m, "%5d %8zdK ", pid_nr(tgid), + (pid_entry.stats.phys_space_shared_proportion + -:461: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #461: FILE: drivers/gpu/drm/i915/i915_gem.c:6818: + pid_entry.stats.phys_space_allocated_priv)/1024); ^ -:468: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #468: FILE: drivers/gpu/drm/i915/i915_gem.c:6825: + drm_ht_remove_item(&pid_entry.namelist, + &entry->hash_item); -:489: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #489: FILE: drivers/gpu/drm/i915/i915_gem.c:6863: +int i915_gem_get_obj_info(struct drm_i915_error_state_buf *m, + struct drm_device *dev, struct pid *tgid) -:512: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #512: FILE: drivers/gpu/drm/i915/i915_gpu_error.c:863: +int i915_obj_state_buf_init(struct drm_i915_error_state_buf *ebuf, + size_t count) -:518: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!ebuf->buf" #518: FILE: drivers/gpu/drm/i915/i915_gpu_error.c:869: + if (ebuf->buf == NULL) -:549: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #549: FILE: drivers/gpu/drm/i915/i915_sysfs.c:585: } +#define GEM_OBJ_STAT_BUF_SIZE (4*1024) /* 4KB */ -:549: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #549: FILE: drivers/gpu/drm/i915/i915_sysfs.c:585: +#define GEM_OBJ_STAT_BUF_SIZE (4*1024) /* 4KB */ ^ -:550: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #550: FILE: drivers/gpu/drm/i915/i915_sysfs.c:586: +#define GEM_OBJ_STAT_BUF_SIZE_MAX (1024*1024) /* 1MB */ ^ -:559: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #559: FILE: drivers/gpu/drm/i915/i915_sysfs.c:595: +static ssize_t i915_gem_read_objects(struct file *filp, + struct kobject *memtrack_kobj, -:601: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #601: FILE: drivers/gpu/drm/i915/i915_sysfs.c:637: + DRM_ERROR( -:610: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #610: FILE: drivers/gpu/drm/i915/i915_sysfs.c:646: + ret = i915_obj_state_buf_init(&attr_priv->buf, + buf_size); -:612: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #612: FILE: drivers/gpu/drm/i915/i915_sysfs.c:648: + DRM_ERROR( -:643: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #643: FILE: drivers/gpu/drm/i915/i915_sysfs.c:679: + ret = i915_obj_state_buf_init(&attr_priv->buf, + buf_size); -:645: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #645: FILE: drivers/gpu/drm/i915/i915_sysfs.c:681: + DRM_ERROR( -:657: CHECK:BRACES: braces {} should be used on all arms of this statement #657: FILE: drivers/gpu/drm/i915/i915_sysfs.c:693: + if (bytes_available > 0) { [...] + } else [...] -:660: CHECK:BRACES: Unbalanced braces around else statement #660: FILE: drivers/gpu/drm/i915/i915_sysfs.c:696: + } else -:690: WARNING:SYMBOLIC_PERMS: Symbolic permissions 'S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH' are not preferred. Consider using octal permissions '0644'. #690: FILE: drivers/gpu/drm/i915/i915_sysfs.c:726: + obj_attr->attr.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; -:700: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #700: FILE: drivers/gpu/drm/i915/i915_sysfs.c:736: + DRM_ERROR( -:723: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!obj_attr" #723: FILE: drivers/gpu/drm/i915/i915_sysfs.c:759: + if (WARN_ON(obj_attr == NULL)) total: 0 errors, 1 warnings, 34 checks, 664 lines checked 486204b0dac9 drm/i915: Output the user virtual addresses for GFX buffers -:97: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #97: FILE: drivers/gpu/drm/i915/i915_gem.c:6345: + list_for_each_entry_safe(virt_entry, + virt_next, -:165: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!new_entry" #165: FILE: drivers/gpu/drm/i915/i915_gem.c:6426: + if (new_entry == NULL) { -:172: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #172: FILE: drivers/gpu/drm/i915/i915_gem.c:6433: + list_add_tail(&new_entry->head, + &pid_entry->virt_addr_head); -:212: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #212: FILE: drivers/gpu/drm/i915/i915_gem.c:6579: + err_printf(m, " %p", + (void *)(virt_entry->user_virt_addr & ~1)); -:215: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #215: FILE: drivers/gpu/drm/i915/i915_gem.c:6582: + err_printf(m, " %p*", + (void *)virt_entry->user_virt_addr); total: 0 errors, 0 warnings, 5 checks, 199 lines checked 05a4782cc77f drm/i915: Update process mm stats for Gen GFX memory -:80: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #80: FILE: drivers/gpu/drm/i915/i915_gem.c:6306: + add_mm_counter(pid_entry->attr_priv->mm, MM_FILEPAGES, + new_size - old_size); -:248: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #248: FILE: drivers/gpu/drm/i915/i915_sysfs.c:770: + add_mm_counter(attr_priv->mm, MM_FILEPAGES, + -attr_priv->rss_size); total: 0 errors, 0 warnings, 2 checks, 192 lines checked _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx