Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe7d4ccd authored by Mark Brown's avatar Mark Brown
Browse files

regmap: async: Add tracepoints for async I/O



Trace when we start and complete async writes, and when we start and
finish blocking for their completion. This is useful for performance
analysis of the resulting I/O patterns.

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 6dbe51c2
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -999,6 +999,8 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
		if (!async)
		if (!async)
			return -ENOMEM;
			return -ENOMEM;


		trace_regmap_async_write_start(map->dev, reg, val_len);

		async->work_buf = kzalloc(map->format.buf_size,
		async->work_buf = kzalloc(map->format.buf_size,
					  GFP_KERNEL | GFP_DMA);
					  GFP_KERNEL | GFP_DMA);
		if (!async->work_buf) {
		if (!async->work_buf) {
@@ -1640,6 +1642,8 @@ void regmap_async_complete_cb(struct regmap_async *async, int ret)
	struct regmap *map = async->map;
	struct regmap *map = async->map;
	bool wake;
	bool wake;


	trace_regmap_async_io_complete(map->dev);

	spin_lock(&map->async_lock);
	spin_lock(&map->async_lock);


	list_del(&async->list);
	list_del(&async->list);
@@ -1686,6 +1690,8 @@ int regmap_async_complete(struct regmap *map)
	if (!map->bus->async_write)
	if (!map->bus->async_write)
		return 0;
		return 0;


	trace_regmap_async_complete_start(map->dev);

	wait_event(map->async_waitq, regmap_async_is_done(map));
	wait_event(map->async_waitq, regmap_async_is_done(map));


	spin_lock_irqsave(&map->async_lock, flags);
	spin_lock_irqsave(&map->async_lock, flags);
@@ -1693,6 +1699,8 @@ int regmap_async_complete(struct regmap *map)
	map->async_ret = 0;
	map->async_ret = 0;
	spin_unlock_irqrestore(&map->async_lock, flags);
	spin_unlock_irqrestore(&map->async_lock, flags);


	trace_regmap_async_complete_done(map->dev);

	return ret;
	return ret;
}
}
EXPORT_SYMBOL_GPL(regmap_async_complete);
EXPORT_SYMBOL_GPL(regmap_async_complete);
+48 −0
Original line number Original line Diff line number Diff line
@@ -175,6 +175,54 @@ DEFINE_EVENT(regmap_bool, regmap_cache_bypass,


);
);


DECLARE_EVENT_CLASS(regmap_async,

	TP_PROTO(struct device *dev),

	TP_ARGS(dev),

	TP_STRUCT__entry(
		__string(	name,		dev_name(dev)	)
	),

	TP_fast_assign(
		__assign_str(name, dev_name(dev));
	),

	TP_printk("%s", __get_str(name))
);

DEFINE_EVENT(regmap_block, regmap_async_write_start,

	TP_PROTO(struct device *dev, unsigned int reg, int count),

	TP_ARGS(dev, reg, count)
);

DEFINE_EVENT(regmap_async, regmap_async_io_complete,

	TP_PROTO(struct device *dev),

	TP_ARGS(dev)

);

DEFINE_EVENT(regmap_async, regmap_async_complete_start,

	TP_PROTO(struct device *dev),

	TP_ARGS(dev)

);

DEFINE_EVENT(regmap_async, regmap_async_complete_done,

	TP_PROTO(struct device *dev),

	TP_ARGS(dev)

);

#endif /* _TRACE_REGMAP_H */
#endif /* _TRACE_REGMAP_H */


/* This part must be outside protection */
/* This part must be outside protection */