Page MenuHomeFreeBSD

D32558.id97193.diff
No OneTemporary

D32558.id97193.diff

Index: usr.sbin/bhyve/pci_nvme.c
===================================================================
--- usr.sbin/bhyve/pci_nvme.c
+++ usr.sbin/bhyve/pci_nvme.c
@@ -62,6 +62,7 @@
#include <sys/errno.h>
#include <sys/types.h>
#include <net/ieee_oui.h>
+#include <sys/time.h>
#include <assert.h>
#include <pthread.h>
@@ -300,6 +301,7 @@
__uint128_t write_commands;
uint32_t read_dunits_remainder;
uint32_t write_dunits_remainder;
+ struct timeval power_on_time;
STAILQ_HEAD(, pci_nvme_aer) aer_list;
uint32_t aer_count;
@@ -503,6 +505,8 @@
cd->fna = 0x03;
cd->power_state[0].mp = 10;
+
+ gettimeofday(&sc->power_on_time, NULL);
}
/*
@@ -609,6 +613,9 @@
sc->health_log.temperature = 310;
sc->health_log.available_spare = 100;
sc->health_log.available_spare_threshold = 10;
+
+ sc->health_log.power_cycles[1] = 0;
+ sc->health_log.power_cycles[0] = 1;
}
static void
@@ -1071,6 +1078,8 @@
{
uint32_t logsize;
uint8_t logpage = command->cdw10 & 0xFF;
+ struct timeval now;
+ __uint128_t power_on_hours;
DPRINTF("%s log page %u len %u", __func__, logpage, logsize);
@@ -1091,6 +1100,11 @@
NVME_COPY_TO_PRP);
break;
case NVME_LOG_HEALTH_INFORMATION:
+ gettimeofday(&now, NULL);
+ power_on_hours = (now.tv_sec - sc->power_on_time.tv_sec) / 3600;
+ memcpy(&sc->health_log.power_on_hours, &power_on_hours,
+ sizeof(sc->health_log.power_on_hours));
+
pthread_mutex_lock(&sc->mtx);
memcpy(&sc->health_log.data_units_read, &sc->read_data_units,
sizeof(sc->health_log.data_units_read));

File Metadata

Mime Type
text/plain
Expires
Mon, Sep 7, 12:39 AM (14 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38441489
Default Alt Text
D32558.id97193.diff (1 KB)

Event Timeline