Re: [PATCH v2] dma-mapping: benchmark: pretend DMA is transmitting

From: Christoph Hellwig
Date: Fri Feb 05 2021 - 05:40:22 EST


On Fri, Feb 05, 2021 at 10:32:26AM +0000, Song Bao Hua (Barry Song) wrote:
> I can keep the struct size unchanged by changing the struct to
>
> struct map_benchmark {
> __u64 avg_map_100ns; /* average map latency in 100ns */
> __u64 map_stddev; /* standard deviation of map latency */
> __u64 avg_unmap_100ns; /* as above */
> __u64 unmap_stddev;
> __u32 threads; /* how many threads will do map/unmap in parallel */
> __u32 seconds; /* how long the test will last */
> __s32 node; /* which numa node this benchmark will run on */
> __u32 dma_bits; /* DMA addressing capability */
> __u32 dma_dir; /* DMA data direction */
> __u32 dma_trans_ns; /* time for DMA transmission in ns */
>
> __u32 exp; /* For future use */
> __u64 expansion[9]; /* For future use */
> };
>
> But the code is really ugly now.

Thats why we usually use __u8 fields for reserved field. You might
consider just switching to that instead while you're at it. I guess
we'll just have to get the addition into 5.11 then to make sure we
don't release a kernel with the alignment fix.