Re: [PATCH] habanalabs: improve error messages

Joe Perches
2019-03-29T16:39:47Z

On Fri, 2019-03-29 at 17:29 +0100, Greg KH wrote:
> On Thu, Mar 28, 2019 at 09:13:13AM +0200, Oded Gabbay wrote:
> > This patch improves two error messages to help the user to
> > better understand what error occurred.
[]
> > diff --git a/drivers/misc/habanalabs/memory.c b/drivers/misc/habanalabs/memory.c
[]
> > @@ -109,7 +109,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
> > page_size);
> > if (!phys_pg_pack->pages[i]) {
> > dev_err(hdev->dev,
> > - "ioctl failed to allocate page\n");
> > + "Failed to allocate device memory (out of memory)\n");
>
> No need for a message at all here, right? The core should have already
> told you you had a problem.

I do not understand this code all that well, but I am uncertain
if all the possible pool allocation functions emit an OOM message
on failure.

Also, there is another pool allocation for the contiguous
allocation attempt that has a similar OOM in this function.