[igt-dev] [PATCH igt] lib: Dump meminfo and slabinfo if we complain about insufficient memory

Antonio Argenziano antonio.argenziano at intel.com
Tue Apr 10 16:00:52 UTC 2018



On 10/04/18 05:20, Chris Wilson wrote:
> All too frequently, we fail our memory checks to a leak in the driver.
> While we give every opportunity for the driver to release the memory
> before we fail, if we do dump the meminfo and slabinfo, if available, so
> we can assign blame^W^W resolve the problem quickly.
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=105967
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Martin Peres <martin.peres at linux.intel.com>
> Cc: Tomi Sarvela <tomi.p.sarvela at intel.com>
> ---
>   lib/intel_os.c | 28 ++++++++++++++++++++++++++--
>   1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/intel_os.c b/lib/intel_os.c
> index bb2c16bf..f0f2872b 100644
> --- a/lib/intel_os.c
> +++ b/lib/intel_os.c
> @@ -51,6 +51,7 @@
>   #include "drmtest.h"
>   #include "igt_aux.h"
>   #include "igt_debugfs.h"
> +#include "igt_sysfs.h"
>   
>   /**
>    * intel_get_total_ram_mb:
> @@ -280,9 +281,32 @@ int __intel_check_memory(uint64_t count, uint64_t size, unsigned mode,
>   void intel_require_memory(uint64_t count, uint64_t size, unsigned mode)
>   {
>   	uint64_t required, total;
> +	bool sufficient_memory;
> +
> +	sufficient_memory = __intel_check_memory(count, size, mode,
> +						 &required, &total);
> +	if (!sufficient_memory) {
> +		int dir = open("/proc", O_RDONLY);

No early exit on dir < 0?

LGTM.
Reviewed-by: Antonio Argenziano <antonio.argenziano at intel.com>

Thanks,
Antonio


More information about the igt-dev mailing list