From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E95D4C433DB for ; Fri, 5 Feb 2021 10:35:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A13F064F41 for ; Fri, 5 Feb 2021 10:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbhBEKfp convert rfc822-to-8bit (ORCPT ); Fri, 5 Feb 2021 05:35:45 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:2575 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231290AbhBEKdO (ORCPT ); Fri, 5 Feb 2021 05:33:14 -0500 Received: from DGGEMM405-HUB.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4DXBWX44nRzW78d; Fri, 5 Feb 2021 18:30:16 +0800 (CST) Received: from dggemi712-chm.china.huawei.com (10.3.20.111) by DGGEMM405-HUB.china.huawei.com (10.3.20.213) with Microsoft SMTP Server (TLS) id 14.3.498.0; Fri, 5 Feb 2021 18:32:26 +0800 Received: from dggemi761-chm.china.huawei.com (10.1.198.147) by dggemi712-chm.china.huawei.com (10.3.20.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Fri, 5 Feb 2021 18:32:26 +0800 Received: from dggemi761-chm.china.huawei.com ([10.9.49.202]) by dggemi761-chm.china.huawei.com ([10.9.49.202]) with mapi id 15.01.2106.006; Fri, 5 Feb 2021 18:32:26 +0800 From: "Song Bao Hua (Barry Song)" To: Christoph Hellwig CC: "m.szyprowski@samsung.com" , "robin.murphy@arm.com" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linuxarm@openeuler.org" Subject: RE: [PATCH v2] dma-mapping: benchmark: pretend DMA is transmitting Thread-Topic: [PATCH v2] dma-mapping: benchmark: pretend DMA is transmitting Thread-Index: AQHW+2OBR5g3s4IewkuPPN58KPwDpapIw5uAgACOkOA= Date: Fri, 5 Feb 2021 10:32:26 +0000 Message-ID: References: <20210205020035.25340-1-song.bao.hua@hisilicon.com> <20210205092113.GA870@lst.de> In-Reply-To: <20210205092113.GA870@lst.de> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.126.202.19] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Christoph Hellwig [mailto:hch@lst.de] > Sent: Friday, February 5, 2021 10:21 PM > To: Song Bao Hua (Barry Song) > Cc: m.szyprowski@samsung.com; hch@lst.de; robin.murphy@arm.com; > iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org; > linuxarm@openeuler.org > Subject: Re: [PATCH v2] dma-mapping: benchmark: pretend DMA is transmitting > > On Fri, Feb 05, 2021 at 03:00:35PM +1300, Barry Song wrote: > > + __u32 dma_trans_ns; /* time for DMA transmission in ns */ > > __u64 expansion[10]; /* For future use */ > > We need to keep the struct size, so the expansion field needs to > shrink by the equivalent amount of data that is added in dma_trans_ns. Unfortunately I didn't put a rsv u32 field after dma_dir in the original patch. There were five 32bits data before expansion[]: 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 */ __u64 expansion[10]; /* For future use */ }; My bad. That was really silly. I should have done the below from the first beginning: 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 rsv; __u64 expansion[10]; /* For future use */ }; So on 64bit system, this patch doesn't change the length of struct as the new added u32 just fill the gap between dma_dir and expansion. For 32bit system, this patch increases 4 bytes in the length. 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. Thanks Barry