mirror of
https://github.com/andreas-abel/nanoBench.git
synced 2026-01-04 11:30:06 +01:00
restore OF flag
This commit is contained in:
@@ -515,7 +515,8 @@ void measurement_template_Intel() {
|
|||||||
".intel_syntax noprefix \n"
|
".intel_syntax noprefix \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"lahf \n"
|
"lahf \n"
|
||||||
"push rax \n"
|
"seto al \n"
|
||||||
|
"push rax \n"
|
||||||
"push rcx \n"
|
"push rcx \n"
|
||||||
"push rdx \n"
|
"push rdx \n"
|
||||||
"push r15 \n"
|
"push r15 \n"
|
||||||
@@ -545,7 +546,8 @@ void measurement_template_Intel() {
|
|||||||
"pop rdx; lfence \n"
|
"pop rdx; lfence \n"
|
||||||
"pop rcx; lfence \n"
|
"pop rcx; lfence \n"
|
||||||
"pop rax; lfence \n"
|
"pop rax; lfence \n"
|
||||||
"sahf; lfence \n"
|
"cmp al, -127; lfence \n"
|
||||||
|
"sahf; lfence \n"
|
||||||
"pop rax; \n"
|
"pop rax; \n"
|
||||||
"lfence \n"
|
"lfence \n"
|
||||||
".att_syntax noprefix ");
|
".att_syntax noprefix ");
|
||||||
@@ -642,6 +644,7 @@ void measurement_template_AMD() {
|
|||||||
".intel_syntax noprefix \n"
|
".intel_syntax noprefix \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"lahf \n"
|
"lahf \n"
|
||||||
|
"seto al \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"push rcx \n"
|
"push rcx \n"
|
||||||
"push rdx \n"
|
"push rdx \n"
|
||||||
@@ -682,6 +685,7 @@ void measurement_template_AMD() {
|
|||||||
"pop rdx; lfence \n"
|
"pop rdx; lfence \n"
|
||||||
"pop rcx; lfence \n"
|
"pop rcx; lfence \n"
|
||||||
"pop rax; lfence \n"
|
"pop rax; lfence \n"
|
||||||
|
"cmp al, -127; lfence \n"
|
||||||
"sahf; lfence \n"
|
"sahf; lfence \n"
|
||||||
"pop rax; \n"
|
"pop rax; \n"
|
||||||
"lfence \n"
|
"lfence \n"
|
||||||
@@ -807,6 +811,7 @@ void measurement_FF_template_Intel() {
|
|||||||
".intel_syntax noprefix \n"
|
".intel_syntax noprefix \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"lahf \n"
|
"lahf \n"
|
||||||
|
"seto al \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"push rcx \n"
|
"push rcx \n"
|
||||||
"push rdx \n"
|
"push rdx \n"
|
||||||
@@ -836,6 +841,7 @@ void measurement_FF_template_Intel() {
|
|||||||
"pop rdx; lfence \n"
|
"pop rdx; lfence \n"
|
||||||
"pop rcx; lfence \n"
|
"pop rcx; lfence \n"
|
||||||
"pop rax; lfence \n"
|
"pop rax; lfence \n"
|
||||||
|
"cmp al, -127; lfence \n"
|
||||||
"sahf; lfence \n"
|
"sahf; lfence \n"
|
||||||
"pop rax; \n"
|
"pop rax; \n"
|
||||||
"lfence \n"
|
"lfence \n"
|
||||||
@@ -927,8 +933,9 @@ void measurement_FF_template_AMD() {
|
|||||||
asm(".quad "STRINGIFY(MAGIC_BYTES_INIT));
|
asm(".quad "STRINGIFY(MAGIC_BYTES_INIT));
|
||||||
asm volatile(
|
asm volatile(
|
||||||
".intel_syntax noprefix \n"
|
".intel_syntax noprefix \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"lahf \n"
|
"lahf \n"
|
||||||
|
"seto al \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"push rdx \n"
|
"push rdx \n"
|
||||||
"push r15 \n"
|
"push r15 \n"
|
||||||
@@ -951,6 +958,7 @@ void measurement_FF_template_AMD() {
|
|||||||
"pop r15; lfence \n"
|
"pop r15; lfence \n"
|
||||||
"pop rdx; lfence \n"
|
"pop rdx; lfence \n"
|
||||||
"pop rax; lfence \n"
|
"pop rax; lfence \n"
|
||||||
|
"cmp al, -127; lfence \n"
|
||||||
"sahf; lfence \n"
|
"sahf; lfence \n"
|
||||||
"pop rax; \n"
|
"pop rax; \n"
|
||||||
"lfence \n"
|
"lfence \n"
|
||||||
@@ -1031,6 +1039,7 @@ void measurement_RDTSC_template() {
|
|||||||
".intel_syntax noprefix \n"
|
".intel_syntax noprefix \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"lahf \n"
|
"lahf \n"
|
||||||
|
"seto al \n"
|
||||||
"push rax \n"
|
"push rax \n"
|
||||||
"push rdx \n"
|
"push rdx \n"
|
||||||
"push r15 \n"
|
"push r15 \n"
|
||||||
@@ -1043,6 +1052,7 @@ void measurement_RDTSC_template() {
|
|||||||
"pop r15; lfence \n"
|
"pop r15; lfence \n"
|
||||||
"pop rdx; lfence \n"
|
"pop rdx; lfence \n"
|
||||||
"pop rax; lfence \n"
|
"pop rax; lfence \n"
|
||||||
|
"cmp al, -127; lfence \n"
|
||||||
"sahf; lfence \n"
|
"sahf; lfence \n"
|
||||||
"pop rax; \n"
|
"pop rax; \n"
|
||||||
"lfence \n"
|
"lfence \n"
|
||||||
|
|||||||
@@ -63,11 +63,15 @@ static ssize_t unroll_count_show(struct kobject *kobj, struct kobj_attribute *at
|
|||||||
return sprintf(buf, "%ld\n", unroll_count);
|
return sprintf(buf, "%ld\n", unroll_count);
|
||||||
}
|
}
|
||||||
static ssize_t unroll_count_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) {
|
static ssize_t unroll_count_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) {
|
||||||
|
long old_unroll_count = unroll_count;
|
||||||
sscanf(buf, "%ld", &unroll_count);
|
sscanf(buf, "%ld", &unroll_count);
|
||||||
vfree(runtime_code);
|
|
||||||
runtime_code = __vmalloc(PAGE_SIZE + (unroll_count)*PAGE_SIZE*2 + 10000, GFP_KERNEL, PAGE_KERNEL_EXEC);
|
if (old_unroll_count != unroll_count) {
|
||||||
if (!runtime_code) {
|
vfree(runtime_code);
|
||||||
pr_debug("failed to allocate executable memory\n");
|
runtime_code = __vmalloc(PAGE_SIZE + (unroll_count)*PAGE_SIZE*2 + 10000, GFP_KERNEL, PAGE_KERNEL_EXEC);
|
||||||
|
if (!runtime_code) {
|
||||||
|
pr_debug("failed to allocate executable memory\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -86,10 +90,18 @@ static ssize_t n_measurements_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
return sprintf(buf, "%ld\n", n_measurements);
|
return sprintf(buf, "%ld\n", n_measurements);
|
||||||
}
|
}
|
||||||
static ssize_t n_measurements_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) {
|
static ssize_t n_measurements_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) {
|
||||||
|
long old_n_measurements = n_measurements;
|
||||||
sscanf(buf, "%ld", &n_measurements);
|
sscanf(buf, "%ld", &n_measurements);
|
||||||
for (int i=0; i<MAX_PROGRAMMABLE_COUNTERS; i++) {
|
|
||||||
kfree(measurement_results[i]);
|
if (old_n_measurements != n_measurements) {
|
||||||
measurement_results[i] = kmalloc(n_measurements*sizeof(int64_t), GFP_KERNEL);
|
for (int i=0; i<MAX_PROGRAMMABLE_COUNTERS; i++) {
|
||||||
|
kfree(measurement_results[i]);
|
||||||
|
kfree(measurement_results_base[i]);
|
||||||
|
measurement_results[i] = kmalloc(n_measurements*sizeof(int64_t), GFP_KERNEL);
|
||||||
|
measurement_results_base[i] = kmalloc(n_measurements*sizeof(int64_t), GFP_KERNEL);
|
||||||
|
memset(measurement_results[i], 0, n_measurements*sizeof(int64_t));
|
||||||
|
memset(measurement_results_base[i], 0, n_measurements*sizeof(int64_t));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -322,12 +334,14 @@ static int __init nb_init (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<MAX_PROGRAMMABLE_COUNTERS; i++) {
|
for (int i=0; i<MAX_PROGRAMMABLE_COUNTERS; i++) {
|
||||||
measurement_results[i] = kmalloc(n_measurements*sizeof(int64_t), GFP_KERNEL);
|
measurement_results[i] = kmalloc(n_measurements*sizeof(int64_t), GFP_KERNEL);
|
||||||
measurement_results_base[i] = kmalloc(n_measurements*sizeof(int64_t), GFP_KERNEL);
|
measurement_results_base[i] = kmalloc(n_measurements*sizeof(int64_t), GFP_KERNEL);
|
||||||
if(!measurement_results[i] || !measurement_results_base[i]){
|
if(!measurement_results[i] || !measurement_results_base[i]){
|
||||||
printk(KERN_ERR "Could not allocate memory for measurement_results\n");
|
printk(KERN_ERR "Could not allocate memory for measurement_results\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
memset(measurement_results[i], 0, n_measurements*sizeof(int64_t));
|
||||||
|
memset(measurement_results_base[i], 0, n_measurements*sizeof(int64_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime_mem = kmalloc(2*1024*1024, GFP_KERNEL);
|
runtime_mem = kmalloc(2*1024*1024, GFP_KERNEL);
|
||||||
|
|||||||
Reference in New Issue
Block a user