s390/debug: improve debug_event
debug_event currently truncates the data if used with a size larger than the buf_size of the debug feature. For lots of callers of this function, wrappers have been implemented that loop until all data is handled. Move that functionality into debug_event_common and get rid of the wrappers. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Acked-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
7c3eaaa391
commit
94158e544f
|
@ -18,11 +18,7 @@ extern debug_info_t *pci_debug_err_id;
|
||||||
|
|
||||||
static inline void zpci_err_hex(void *addr, int len)
|
static inline void zpci_err_hex(void *addr, int len)
|
||||||
{
|
{
|
||||||
while (len > 0) {
|
debug_event(pci_debug_err_id, 0, addr, len);
|
||||||
debug_event(pci_debug_err_id, 0, (void *) addr, len);
|
|
||||||
len -= pci_debug_err_id->buf_size;
|
|
||||||
addr += pci_debug_err_id->buf_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -900,12 +900,16 @@ debug_entry_t *debug_event_common(debug_info_t *id, int level, const void *buf,
|
||||||
} else {
|
} else {
|
||||||
spin_lock_irqsave(&id->lock, flags);
|
spin_lock_irqsave(&id->lock, flags);
|
||||||
}
|
}
|
||||||
active = get_active_entry(id);
|
do {
|
||||||
memset(DEBUG_DATA(active), 0, id->buf_size);
|
active = get_active_entry(id);
|
||||||
memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size));
|
memset(DEBUG_DATA(active), 0, id->buf_size);
|
||||||
debug_finish_entry(id, active, level, 0);
|
memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size));
|
||||||
spin_unlock_irqrestore(&id->lock, flags);
|
debug_finish_entry(id, active, level, 0);
|
||||||
|
len -= id->buf_size;
|
||||||
|
buf += id->buf_size;
|
||||||
|
} while (len > 0);
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&id->lock, flags);
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(debug_event_common);
|
EXPORT_SYMBOL(debug_event_common);
|
||||||
|
@ -928,12 +932,16 @@ debug_entry_t *debug_exception_common(debug_info_t *id, int level,
|
||||||
} else {
|
} else {
|
||||||
spin_lock_irqsave(&id->lock, flags);
|
spin_lock_irqsave(&id->lock, flags);
|
||||||
}
|
}
|
||||||
active = get_active_entry(id);
|
do {
|
||||||
memset(DEBUG_DATA(active), 0, id->buf_size);
|
active = get_active_entry(id);
|
||||||
memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size));
|
memset(DEBUG_DATA(active), 0, id->buf_size);
|
||||||
debug_finish_entry(id, active, level, 1);
|
memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size));
|
||||||
spin_unlock_irqrestore(&id->lock, flags);
|
debug_finish_entry(id, active, level, len <= id->buf_size);
|
||||||
|
len -= id->buf_size;
|
||||||
|
buf += id->buf_size;
|
||||||
|
} while (len > 0);
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&id->lock, flags);
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(debug_exception_common);
|
EXPORT_SYMBOL(debug_exception_common);
|
||||||
|
|
|
@ -55,13 +55,7 @@ extern debug_info_t *scm_debug;
|
||||||
|
|
||||||
static inline void SCM_LOG_HEX(int level, void *data, int length)
|
static inline void SCM_LOG_HEX(int level, void *data, int length)
|
||||||
{
|
{
|
||||||
if (!debug_level_enabled(scm_debug, level))
|
debug_event(scm_debug, level, data, length);
|
||||||
return;
|
|
||||||
while (length > 0) {
|
|
||||||
debug_event(scm_debug, level, data, length);
|
|
||||||
length -= scm_debug->buf_size;
|
|
||||||
data += scm_debug->buf_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SCM_LOG_STATE(int level, struct scm_device *scmdev)
|
static inline void SCM_LOG_STATE(int level, struct scm_device *scmdev)
|
||||||
|
|
|
@ -43,11 +43,7 @@ static DEFINE_MUTEX(on_close_mutex);
|
||||||
|
|
||||||
static void CHSC_LOG_HEX(int level, void *data, int length)
|
static void CHSC_LOG_HEX(int level, void *data, int length)
|
||||||
{
|
{
|
||||||
while (length > 0) {
|
debug_event(chsc_debug_log_id, level, data, length);
|
||||||
debug_event(chsc_debug_log_id, level, data, length);
|
|
||||||
length -= chsc_debug_log_id->buf_size;
|
|
||||||
data += chsc_debug_log_id->buf_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_AUTHOR("IBM Corporation");
|
MODULE_AUTHOR("IBM Corporation");
|
||||||
|
|
|
@ -22,13 +22,7 @@ extern debug_info_t *cio_debug_crw_id;
|
||||||
|
|
||||||
static inline void CIO_HEX_EVENT(int level, void *data, int length)
|
static inline void CIO_HEX_EVENT(int level, void *data, int length)
|
||||||
{
|
{
|
||||||
if (unlikely(!cio_debug_trace_id))
|
debug_event(cio_debug_trace_id, level, data, length);
|
||||||
return;
|
|
||||||
while (length > 0) {
|
|
||||||
debug_event(cio_debug_trace_id, level, data, length);
|
|
||||||
length -= cio_debug_trace_id->buf_size;
|
|
||||||
data += cio_debug_trace_id->buf_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,13 +43,7 @@ static debug_info_t *eadm_debug;
|
||||||
|
|
||||||
static void EADM_LOG_HEX(int level, void *data, int length)
|
static void EADM_LOG_HEX(int level, void *data, int length)
|
||||||
{
|
{
|
||||||
if (!debug_level_enabled(eadm_debug, level))
|
debug_event(eadm_debug, level, data, length);
|
||||||
return;
|
|
||||||
while (length > 0) {
|
|
||||||
debug_event(eadm_debug, level, data, length);
|
|
||||||
length -= eadm_debug->buf_size;
|
|
||||||
data += eadm_debug->buf_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void orb_init(union orb *orb)
|
static void orb_init(union orb *orb)
|
||||||
|
|
|
@ -33,11 +33,7 @@ extern debug_info_t *qdio_dbf_error;
|
||||||
|
|
||||||
static inline void DBF_HEX(void *addr, int len)
|
static inline void DBF_HEX(void *addr, int len)
|
||||||
{
|
{
|
||||||
while (len > 0) {
|
debug_event(qdio_dbf_setup, DBF_ERR, addr, len);
|
||||||
debug_event(qdio_dbf_setup, DBF_ERR, addr, len);
|
|
||||||
len -= qdio_dbf_setup->buf_size;
|
|
||||||
addr += qdio_dbf_setup->buf_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DBF_ERROR(text...) \
|
#define DBF_ERROR(text...) \
|
||||||
|
@ -49,11 +45,7 @@ static inline void DBF_HEX(void *addr, int len)
|
||||||
|
|
||||||
static inline void DBF_ERROR_HEX(void *addr, int len)
|
static inline void DBF_ERROR_HEX(void *addr, int len)
|
||||||
{
|
{
|
||||||
while (len > 0) {
|
debug_event(qdio_dbf_error, DBF_ERR, addr, len);
|
||||||
debug_event(qdio_dbf_error, DBF_ERR, addr, len);
|
|
||||||
len -= qdio_dbf_error->buf_size;
|
|
||||||
addr += qdio_dbf_error->buf_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DBF_DEV_EVENT(level, device, text...) \
|
#define DBF_DEV_EVENT(level, device, text...) \
|
||||||
|
@ -68,11 +60,7 @@ static inline void DBF_ERROR_HEX(void *addr, int len)
|
||||||
static inline void DBF_DEV_HEX(struct qdio_irq *dev, void *addr,
|
static inline void DBF_DEV_HEX(struct qdio_irq *dev, void *addr,
|
||||||
int len, int level)
|
int len, int level)
|
||||||
{
|
{
|
||||||
while (len > 0) {
|
debug_event(dev->debug_area, level, addr, len);
|
||||||
debug_event(dev->debug_area, level, addr, len);
|
|
||||||
len -= dev->debug_area->buf_size;
|
|
||||||
addr += dev->debug_area->buf_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int qdio_allocate_dbf(struct qdio_initialize *init_data,
|
int qdio_allocate_dbf(struct qdio_initialize *init_data,
|
||||||
|
|
Loading…
Reference in New Issue