Skip to content

Commit

Permalink
16589 zfs: avoid kfpu use when panicking
Browse files Browse the repository at this point in the history
Reviewed by: Marco van Wieringen <[email protected]>
Reviewed by: Gordon Ross <[email protected]>
Approved by: Dan McDonald <[email protected]>
  • Loading branch information
citrus-it committed Jun 4, 2024
1 parent 12b7c4c commit 4c827c3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions usr/src/uts/common/fs/zfs/sys/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

/*
* Copyright 2020 Joyent, Inc.
* Copyright 2024 Oxide Computer Company
*/

#ifndef _SIMD_H
Expand All @@ -25,6 +26,7 @@
#ifdef _KERNEL
#include <sys/x86_archext.h>
#include <sys/archsystm.h>
#include <sys/systm.h>
#include <sys/kfpu.h>
#include <sys/proc.h>
#include <sys/disp.h>
Expand All @@ -35,6 +37,14 @@ kfpu_allowed(void)
{
extern int zfs_fpu_enabled;

/*
* When panicking, play it safe and avoid kfpu use. This gives the best
* chance of being able to dump successfully, particularly if the panic
* occured around an FPU context switch.
*/
if (panicstr != NULL)
return (0);

return (zfs_fpu_enabled != 0 ? 1 : 0);
}

Expand Down

0 comments on commit 4c827c3

Please sign in to comment.