diff options
-rw-r--r-- | kernel/ethosu_cancel_inference.c | 7 | ||||
-rw-r--r-- | kernel/ethosu_inference.c | 13 |
2 files changed, 17 insertions, 3 deletions
diff --git a/kernel/ethosu_cancel_inference.c b/kernel/ethosu_cancel_inference.c index d89f719..47687b8 100644 --- a/kernel/ethosu_cancel_inference.c +++ b/kernel/ethosu_cancel_inference.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> + * SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com> * SPDX-License-Identifier: GPL-2.0-only * * This program is free software and is provided to you under the terms of the @@ -88,7 +88,7 @@ int ethosu_cancel_inference_request(struct device *dev, /* increase ref count on the inference we are refering to */ ethosu_inference_get(inf); /* mark inference ABORTING to avoid resending the inference message */ - inf->status = ETHOSU_CORE_STATUS_ABORTING; + inf->status = ETHOSU_UAPI_STATUS_ABORTING; cancellation->dev = dev; cancellation->inf = inf; @@ -136,6 +136,9 @@ int ethosu_cancel_inference_request(struct device *dev, goto deregister; } + if (inf->status != ETHOSU_UAPI_STATUS_ABORTED) + inf->status = ETHOSU_UAPI_STATUS_ABORTED; + deregister: ethosu_mailbox_deregister(mailbox, &cancellation->msg); diff --git a/kernel/ethosu_inference.c b/kernel/ethosu_inference.c index 5fbad58..3238d7e 100644 --- a/kernel/ethosu_inference.c +++ b/kernel/ethosu_inference.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright 2020,2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> + * SPDX-FileCopyrightText: Copyright 2020,2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com> * SPDX-License-Identifier: GPL-2.0-only * * This program is free software and is provided to you under the terms of the @@ -437,6 +437,16 @@ void ethosu_inference_rsp(struct ethosu_mailbox *mailbox, inf = container_of(msg, typeof(*inf), msg); + /* + * Don't handle the response if the inference is aborted or + * in the process of being aborted + */ + if (inf->status == ETHOSU_UAPI_STATUS_ABORTED || + inf->status == ETHOSU_UAPI_STATUS_ABORTING) { + inf->status = ETHOSU_UAPI_STATUS_ABORTED; + goto done; + } + if (rsp->status == ETHOSU_CORE_STATUS_OK && inf->ofm_count <= ETHOSU_CORE_BUFFER_MAX) inf->status = ETHOSU_UAPI_STATUS_OK; @@ -469,6 +479,7 @@ void ethosu_inference_rsp(struct ethosu_mailbox *mailbox, inf->pmu_cycle_counter_count); } +done: inf->done = true; wake_up_interruptible(&inf->waitq); ethosu_inference_put(inf); |