Skip to content

Commit

Permalink
stress-ng.h: move core-cpu prototypes into core-cpu.h
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
ColinIanKing committed Mar 3, 2022
1 parent 0a69169 commit 416b67d
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 16 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ OBJS += $(CONFIG_OBJS)
%.o: %.c stress-ng.h config.h git-commit-id.h core-capabilities.h core-put.h \
core-target-clones.h core-pragma.h core-perf.h core-thermal-zone.h \
core-smart.h core-thrash.h core-net.h core-ftrace.h core-cache.h \
core-nt-store.h core-arch.h
core-nt-store.h core-arch.h core-cpu.h
$(Q)echo "CC $<"
$(V)$(CC) $(CFLAGS) -c -o $@ $<

Expand Down Expand Up @@ -508,6 +508,7 @@ dist:
core-thrash.h core-net.h core-ftrace.h core-cache.h \
core-hash.h core-io-priority.h core-nt-store.h \
core-personality.c core-io-uring.c core-arch.h \
core-cpu.h \
COPYING syscalls.txt mascot README.md \
stress-af-alg-defconfigs.h README.Android test snap \
TODO core-perf-event.c usr.bin.pulseaudio.eg \
Expand Down
1 change: 1 addition & 0 deletions core-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define CORE_CACHE_H

#include "core-arch.h"
#include "core-cpu.h"

/*
* cacheflush(2) cache options
Expand Down
1 change: 1 addition & 0 deletions core-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
#include "stress-ng.h"
#include "core-arch.h"
#include "core-cpu.h"

/* Name + dest reg */ /* Input -> Output */
#define CPUID_sse3_ECX (1U << 0) /* EAX=0x1 -> ECX */
Expand Down
39 changes: 39 additions & 0 deletions core-cpu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2022 Colin Ian King.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef CORE_CPU_H
#define CORE_CPU_H

/* Always included after stress-ng.h is included */

extern void stress_x86_cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
extern WARN_UNUSED bool stress_cpu_is_x86(void);
extern WARN_UNUSED bool stress_cpu_x86_has_clflushopt(void);
extern WARN_UNUSED bool stress_cpu_x86_has_clwb(void);
extern WARN_UNUSED bool stress_cpu_x86_has_cldemote(void);
extern WARN_UNUSED bool stress_cpu_x86_has_waitpkg(void);
extern WARN_UNUSED bool stress_cpu_x86_has_rdseed(void);
extern WARN_UNUSED bool stress_cpu_x86_has_syscall(void);
extern WARN_UNUSED bool stress_cpu_x86_has_rdrand(void);
extern WARN_UNUSED bool stress_cpu_x86_has_tsc(void);
extern WARN_UNUSED bool stress_cpu_x86_has_msr(void);
extern WARN_UNUSED bool stress_cpu_x86_has_clfsh(void);
extern WARN_UNUSED bool stress_cpu_x86_has_sse(void);
extern WARN_UNUSED bool stress_cpu_x86_has_sse2(void);

#endif
1 change: 1 addition & 0 deletions stress-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
#include "stress-ng.h"
#include "core-arch.h"
#include "core-cpu.h"
#include "core-put.h"
#include "core-target-clones.h"

Expand Down
1 change: 1 addition & 0 deletions stress-enosys.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
#include "stress-ng.h"
#include "core-arch.h"
#include "core-cpu.h"
#include "core-pragma.h"

static const stress_help_t help[] = {
Expand Down
15 changes: 0 additions & 15 deletions stress-ng.h
Original file line number Diff line number Diff line change
Expand Up @@ -2591,21 +2591,6 @@ extern void stress_cwd_readwriteable(void);
extern const char *stress_signal_name(const int signum);
extern const char *stress_strsignal(const int signum);

/* CPU helpers */
extern void stress_x86_cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
extern WARN_UNUSED bool stress_cpu_is_x86(void);
extern WARN_UNUSED bool stress_cpu_x86_has_cldemote(void);
extern WARN_UNUSED bool stress_cpu_x86_has_clfsh(void);
extern WARN_UNUSED bool stress_cpu_x86_has_clflushopt(void);
extern WARN_UNUSED bool stress_cpu_x86_has_clwb(void);
extern WARN_UNUSED bool stress_cpu_x86_has_msr(void);
extern WARN_UNUSED bool stress_cpu_x86_has_rdrand(void);
extern WARN_UNUSED bool stress_cpu_x86_has_rdseed(void);
extern WARN_UNUSED bool stress_cpu_x86_has_sse(void);
extern WARN_UNUSED bool stress_cpu_x86_has_sse2(void);
extern WARN_UNUSED bool stress_cpu_x86_has_syscall(void);
extern WARN_UNUSED bool stress_cpu_x86_has_tsc(void);

/* Fast random numbers */
extern uint32_t stress_mwc32(void);
extern uint64_t stress_mwc64(void);
Expand Down
1 change: 1 addition & 0 deletions stress-rdrand.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
#include "stress-ng.h"
#include "core-arch.h"
#include "core-cpu.h"

#if defined(HAVE_SYS_CAPABILITY_H)
#include <sys/capability.h>
Expand Down
1 change: 1 addition & 0 deletions stress-sigsegv.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
#include "stress-ng.h"
#include "core-arch.h"
#include "core-cpu.h"
#include "core-nt-store.h"

static sigjmp_buf jmp_env;
Expand Down
1 change: 1 addition & 0 deletions stress-smi.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
#include "stress-ng.h"
#include "core-arch.h"
#include "core-cpu.h"
#include "core-capabilities.h"

#if defined(HAVE_SYS_IO_H)
Expand Down
1 change: 1 addition & 0 deletions stress-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*
*/
#include "stress-ng.h"
#include "core-cpu.h"
#include "core-nt-store.h"

#define MIN_STREAM_L3_SIZE (4 * KB)
Expand Down
1 change: 1 addition & 0 deletions stress-tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
#include "stress-ng.h"
#include "core-arch.h"
#include "core-cpu.h"

#if defined(HAVE_SYS_PLATFORM_PPC_H)
#include <sys/platform/ppc.h>
Expand Down
1 change: 1 addition & 0 deletions stress-udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*
*/
#include "stress-ng.h"
#include "core-cpu.h"
#include "core-net.h"

#if defined(HAVE_LINUX_SOCKIOS_H)
Expand Down
1 change: 1 addition & 0 deletions stress-x86syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*
*/
#include "stress-ng.h"
#include "core-cpu.h"

static const stress_help_t help[] = {
{ NULL, "x86syscall N", "start N workers exercising functions using syscall" },
Expand Down

0 comments on commit 416b67d

Please sign in to comment.