From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BB7BA034C; Tue, 11 Jan 2022 17:55:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F08D42743; Tue, 11 Jan 2022 17:55:20 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id F18B6410F1; Tue, 11 Jan 2022 17:55:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641920118; x=1673456118; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=NyK2QVlmFg7lS26qLZPgsUEzl2bJf9Ka/09mJCZ5Sw4=; b=bAFhFV0MojCZBa3882sRdbYFOuOIV6BWb7cnbDwwrxGuPMDk44xALsrd sX++oEK2JZDGrPWf/1fYnb2azJnU34vl1i33aw+9ifXqhiUyR+aXBq3sp ky8buo7E4aoObYL2eyvT+PAeDQgQ7S6V4utr1iG7D1a8FgsiXDbVIGm3H eo9qKSDE+zy117dy8964VI2kXCqg+MHW/jG3vePN1LkhK3wn5l8osOnUT 1OSBwhSAv+TdEL2ELPCnmT4HzUoK+Ih47/wy5CKHE0tNVXKdUqjTLCnZU kV33lJqyOk+mf2qwX+ppJo5XkA6M1LrLA7586PJJXkRV6GmWIFqljXLzX g==; X-IronPort-AV: E=McAfee;i="6200,9189,10223"; a="242348287" X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="242348287" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2022 08:50:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="669867379" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga001.fm.intel.com with ESMTP; 11 Jan 2022 08:50:31 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 11 Jan 2022 08:50:31 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Tue, 11 Jan 2022 08:50:31 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.170) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Tue, 11 Jan 2022 08:50:30 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VOVk39ntJ0zpN+AgrMZqGjeMgjv6QEb7+hXM4w8VHlBuI5jr96frjZga/A/gj0EjoXCCrsGzTM48UHsjV04ikhs7HpIEOSvadd4f4DFBdz1I4biAvXhIOOQw1+IdAKrNg7aTveGd6yfHdmV4zxzzzAGDLFBtRWzH/05+1nhh517Oj0mzKNym3raV/wX5Ui0b2JuDfUH0a0pS4o4EhtNGnwlRTSvAOGY8yb7N8DO0feyXUQ5ePP+knhhnS+z0iNdL7wxA+Nqb+dLOzLg3MPaQFL/RkKKPAMp6gpE8ZQ6RHh+9leBN6evOUG50RE66mYRUtqdkdtQv7oB5WNX3nN8n5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TqFz64isRt9yHQxnRHQHmek09UlM98nWThQNSfhOUN0=; b=PaXEgNamYdClUH0rPkn5D5+BB2kuglnlwlkoUE6Ey7TGlmv2kGM6+ueP2dHh/ZOUNF/phLEaKHOIr/ViHkz1ARkUdoc3sHyFWrG5+TiXXRmBhoCozA7TnxxziFmCa5avOJWiNJWDUyLjA+ns1ywAZZSpWKkfmreboUJup3qeTHXcNQtiFPDzQrrgkdUyMUCXezmb5+UlbCuVYml7gDsghvTcOs+KO86didR9tJ/8FePAGiobvLoA64J9Naz0i/TeBWXEZtPTSl6T18SAlnp29+npirmOYRk5wOBvNMf2zXbTIylQj5+LWbV0r1gOHX2j4pMIv+fLq6njmcihRj3KqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by CO1PR11MB4915.namprd11.prod.outlook.com (2603:10b6:303:93::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Tue, 11 Jan 2022 16:50:27 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::b8a9:e4f7:e037:771b]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::b8a9:e4f7:e037:771b%7]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 16:50:27 +0000 Message-ID: Date: Tue, 11 Jan 2022 16:50:20 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH v2 3/4] dma/idxd: fix wrap-around in burst capacity calculation To: Bruce Richardson , CC: , Sunil Pai G , Conor Walsh , Chengwen Feng References: <20211220170514.736732-1-bruce.richardson@intel.com> <20220111134105.1007191-1-bruce.richardson@intel.com> <20220111134105.1007191-4-bruce.richardson@intel.com> From: Kevin Laatz In-Reply-To: <20220111134105.1007191-4-bruce.richardson@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0114.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::11) To MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b8f0d74-5842-4085-28ac-08d9d5227841 X-MS-TrafficTypeDiagnostic: CO1PR11MB4915:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nCZdgN2c1iOJsmhOnZGPINm5mgoVCqpaN/hMX9ddvt7wpQ8jdNjf9gK972wYRH7oz2sNXUZ2GCgD/YoEPwASMPmkos3tsXug0l+MQtB8Txkwuo/g4WO6HmnreK+ghXvvlOubhhVkEVmcufbCIdcj32O+U7dA1H/Xglq2Xu33xAyuYKJOu3WGFBdMKJMCgQ2w7+DIVrlhNNn3AgyF3CI6KzWQ/sOadpsp5U3+Gg4wK1g9i32v33U1O3Na2PatKPxm8aCJXFh1J+fZ4pjWVLiRIhMet0p3zYMQ75SabT39qGrNygE/9NCLmvyvMMaF1suI08ld57vHR67ckOwSn6k9nWEFU2qt0DfhwLeZkW4g+k6oHYoX6XJCUh0npiNm81I2JxAs0RQtYuxCaDVd8+F2qkh1nRYkXpDs3hM9NpO/jrPOIYMpPtUYTqC5aRbgl+AY08E32LJBZA9tXujpapuGAvDTZMBXHnw0c8Y9OmS1vKCsKjQQGITAfvIHVKmSjweVU8GOF2OGKBa0+KzwjPTy2BV1JUcVDngZo9K7v81vj2UpIZOpCg9ztFYNcC5Ve7dIgXrava6nnbJISZqqTOdh1ZTkcJ5GFr2JcxC9+FjR+rgX+jCA7iTlW13J1djT+YCdpk5GQPIUygcduluJEtTgsq6HeLkDhS6bdwbYJXeSsl2HlAdCQlAEN6aN7nKAvq5w0bWiput7v5f6R+WQ2Yxk7wzgHXqMa3VWwPP2V5qMOPU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5872.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(316002)(508600001)(83380400001)(4744005)(38100700002)(66556008)(66476007)(66946007)(6512007)(6486002)(8676002)(6666004)(36756003)(31686004)(82960400001)(186003)(2616005)(44832011)(6506007)(86362001)(2906002)(53546011)(26005)(4326008)(31696002)(54906003)(5660300002)(8936002)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QzNhWVBKNVVKckJobU8wZ2tESEdlZGRHakJuL0Z0ZlBUMXZxMHhHbmJwTzQx?= =?utf-8?B?YVFhcVJRSWFtTGtaYktUV25sYlJmSEtkZUoyU2FESCttZGNBUHNheU9WUSsr?= =?utf-8?B?NmZPREM0bTcyM0VIaWNQMHlyZFRkY2UvUlhLbHI4V0hjKzExU29uZDFETzFN?= =?utf-8?B?RUNicysvNzdnc1VDWVhMWHVzWDVHUENYS1NOTkJucHlPNjczMWdFcVdWcFRW?= =?utf-8?B?Z2FSaXhrZ0xRSEpSQ3QxNlIrcWNPdWlCMTlTZHk4UHZrV2NYTXViZG5SM25M?= =?utf-8?B?cG9mT0NiWG15aXdUcWVJY0ZBdTJOTG5reUxwK2NwcW53V1BETGZwVEgvc1NM?= =?utf-8?B?TFYxNURJTFY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1UGNDQStkTUda?= =?utf-8?Q?S9UDdO6QIcEVEJiAeaGgeRY=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 4b8f0d74-5842-4085-28ac-08d9d5227841 X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 16:50:27.5744 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PYfilv20KhWXZi8SPhT7D6Qn3aDU1z3IQFd2r3n8e3zE9nuhZSIHS8lCpibQsFs8luPOI5QWKr3kE5cL4BbPuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4915 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 11/01/2022 13:41, Bruce Richardson wrote: > The burst capacity calculation code assumes that the write and read > (i.e. ids_returned) values both wrap at the ring-size, but the read > value instead wraps as UINT16_MAX. Therefore, instead of just adding > ring-size to the write value in case the read is greater, we need to > just always mask the result to ensure a correct, in-range, value. > > Fixes: 9459de4edc99 ("dma/idxd: add burst capacity") > Cc: kevin.laatz@intel.com > Cc: stable@dpdk.org > > Reported-by: Sunil Pai G > Signed-off-by: Bruce Richardson > --- > drivers/dma/idxd/idxd_common.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > Acked-by: Kevin Laatz