It seems like the following code (dma-proxy-test.c) may be incorrect and appears to lead to issues that eventually result in a kernel panic if the test is run multiple times.
Line 422
for (i = 0; i < TX_CHANNEL_COUNT; i++) {
pthread_join(tx_channels[i].tid, NULL);
munmap(tx_channels[i].buf_ptr, sizeof(struct channel_buffer));
close(tx_channels[i].fd);
}
for (i = 0; i < RX_CHANNEL_COUNT; i++) {
munmap(rx_channels[i].buf_ptr, sizeof(struct channel_buffer));
close(rx_channels[i].fd);
}
I believe the code should be:
for (i = 0; i < TX_CHANNEL_COUNT; i++) {
pthread_join(tx_channels[i].tid, NULL);
munmap(tx_channels[i].buf_ptr, sizeof(struct channel_buffer)* TX_BUFFER_COUNT);
close(tx_channels[i].fd);
}
for (i = 0; i < RX_CHANNEL_COUNT; i++) {
munmap(rx_channels[i].buf_ptr, sizeof(struct channel_buffer)* RX_BUFFER_COUNT);
close(rx_channels[i].fd);
}
It seems like the following code (dma-proxy-test.c) may be incorrect and appears to lead to issues that eventually result in a kernel panic if the test is run multiple times.
Line 422
I believe the code should be:
Additionally, line 352:
Has a clear bug since
BUFFER_SIZE
is in Bytes. Code should be