Commit f04c0f3e authored by Guo Xuenan's avatar Guo Xuenan Committed by Yuntao Liu
Browse files

make OPTIMIZE_INLINING config editable

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8PGC4



--------------------------------

for performance reasons, hulk 6.6 do not use OPTIMIZE_INLINING.
it using gnu_inline attribute causing inline functions not really inline,
which introducing performance issues,so we make it editable(default disable)
and adapt some link conflicting functions.

Signed-off-by: default avatarGuo Xuenan <guoxuenan@huawei.com>
Signed-off-by: default avatarYuntao Liu <liuyuntao12@huawei.com>
parent 56cf5545
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -100,8 +100,13 @@ struct sys_reg_desc {
#define REG_USER_WI		(1 << 3) /* WI from userspace only */

static __printf(2, 3)
#if defined(CONFIG_OPTIMIZE_INLINING)
inline void print_sys_reg_msg(const struct sys_reg_params *p,
					char *fmt, ...)
#else
void print_sys_reg_msg(const struct sys_reg_params *p,
					char *fmt, ...)
#endif
{
	va_list va;

+30 −0
Original line number Diff line number Diff line
@@ -45,6 +45,36 @@
#include "diag/fw_tracer.h"
#include "diag/reporter_vnic.h"

#if defined(CONFIG_OPTIMIZE_INLINING)
static inline void mlx5_printk(struct mlx5_core_dev *dev, int level,
				const char *format, ...)
#else
static void mlx5_printk(struct mlx5_core_dev *dev, int level,
				const char *format, ...)
#endif
{
	struct device *device = dev->device;
	struct va_format vaf;
	va_list args;

	if (WARN_ONCE(level < LOGLEVEL_EMERG || level > LOGLEVEL_DEBUG,
		      "Level %d is out of range, set to default level\n", level))
		level = LOGLEVEL_DEFAULT;

	va_start(args, format);
	vaf.fmt = format;
	vaf.va = &args;

	dev_printk_emit(level, device, "%s %s: %pV", dev_driver_string(device), dev_name(device),
			&vaf);
	va_end(args);
}

#define mlx5_log(__dev, level, format, ...)			\
	mlx5_printk(__dev, level, "%s:%d:(pid %d): " format,	\
		    __func__, __LINE__, current->pid,		\
		    ##__VA_ARGS__)

enum {
	MAX_MISSES			= 3,
};
+0 −24
Original line number Diff line number Diff line
@@ -97,30 +97,6 @@ do { \
			     __func__, __LINE__, current->pid,	\
			     ##__VA_ARGS__)

static inline void mlx5_printk(struct mlx5_core_dev *dev, int level, const char *format, ...)
{
	struct device *device = dev->device;
	struct va_format vaf;
	va_list args;

	if (WARN_ONCE(level < LOGLEVEL_EMERG || level > LOGLEVEL_DEBUG,
		      "Level %d is out of range, set to default level\n", level))
		level = LOGLEVEL_DEFAULT;

	va_start(args, format);
	vaf.fmt = format;
	vaf.va = &args;

	dev_printk_emit(level, device, "%s %s: %pV", dev_driver_string(device), dev_name(device),
			&vaf);
	va_end(args);
}

#define mlx5_log(__dev, level, format, ...)			\
	mlx5_printk(__dev, level, "%s:%d:(pid %d): " format,	\
		    __func__, __LINE__, current->pid,		\
		    ##__VA_ARGS__)

static inline struct device *mlx5_core_dma_dev(struct mlx5_core_dev *dev)
{
	return &dev->pdev->dev;
+4 −0
Original line number Diff line number Diff line
@@ -20,7 +20,11 @@

extern int (*sh_css_printf)(const char *fmt, va_list args);
/* depends on host supplied print function in ia_css_init() */
#if defined(CONFIG_OPTIMIZE_INLINING)
static inline  __printf(1, 2) void ia_css_print(const char *fmt, ...)
#else
static __printf(1, 2) void ia_css_print(const char *fmt, ...)
#endif
{
	va_list ap;

+15 −0
Original line number Diff line number Diff line
@@ -252,6 +252,7 @@ static struct trace_event_fields trace_event_fields_##call[] = { \
#include "stages/stage5_get_offsets.h"

#undef DECLARE_EVENT_CLASS
#if defined(CONFIG_OPTIMIZE_INLINING)
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)	\
static inline notrace int trace_event_get_offsets_##call(		\
	struct trace_event_data_offsets_##call *__data_offsets, proto)	\
@@ -264,6 +265,20 @@ static inline notrace int trace_event_get_offsets_##call( \
									\
	return __data_size;						\
}
#else
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)	\
static notrace int trace_event_get_offsets_##call(			\
	struct trace_event_data_offsets_##call *__data_offsets, proto)	\
{									\
	int __data_size = 0;						\
	int __maybe_unused __item_length;				\
	struct trace_event_raw_##call __maybe_unused *entry;		\
									\
	tstruct;							\
									\
	return __data_size;						\
}
#endif

#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

Loading