gpu: nvgpu: add write barrier after setting notifier info32

While checking the GPU error status, userspace polls on the error
notifier 'status' and then verifies 'status' and 'info32'. nvgpu
sets 'info32' before 'status', so put a write barrier between
those two writes for the consistency between userspace and
kernel view of the error notifier state.

JIRA NVGPU-7538
Bug 200717195
Bug 3250920

Change-Id: I92ac0589283fee823f3366ac594d03b8f27f3590
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2680320
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
This commit is contained in:
Sagar Kamble
2022-03-11 21:28:51 +05:30
committed by mobile promotions
parent 7e045bd2b4
commit 373167883e

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017-2021, NVIDIA Corporation. All rights reserved. * Copyright (c) 2017-2022, NVIDIA Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -17,6 +17,7 @@
#include <nvgpu/enabled.h> #include <nvgpu/enabled.h>
#include <nvgpu/debug.h> #include <nvgpu/debug.h>
#include <nvgpu/error_notifier.h> #include <nvgpu/error_notifier.h>
#include <nvgpu/barrier.h>
#include <nvgpu/os_sched.h> #include <nvgpu/os_sched.h>
#include <nvgpu/gk20a.h> #include <nvgpu/gk20a.h>
#include <nvgpu/channel.h> #include <nvgpu/channel.h>
@@ -137,6 +138,7 @@ void nvgpu_set_err_notifier_locked(struct nvgpu_channel *ch, u32 error)
notification->time_stamp.nanoseconds[1] = notification->time_stamp.nanoseconds[1] =
(u32)(nsec >> 32); (u32)(nsec >> 32);
notification->info32 = error; notification->info32 = error;
nvgpu_wmb();
notification->status = 0xffff; notification->status = 0xffff;
if (error == NVGPU_CHANNEL_RESETCHANNEL_VERIF_ERROR) { if (error == NVGPU_CHANNEL_RESETCHANNEL_VERIF_ERROR) {