From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by dpdk.org (Postfix) with ESMTP id EA8D85907 for ; Tue, 24 Jun 2014 12:05:55 +0200 (CEST) Received: by mail-wi0-f177.google.com with SMTP id r20so273359wiv.16 for ; Tue, 24 Jun 2014 03:06:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=puF92QujaOlXrqjngUhnU/9pP1p95WNP/qJDWnbP42s=; b=Fe63ryPplMcBBlPt3PqNXYZF/ZdWGGVRAwWkfgV8ZcD0+yssl2S1NvH7u4V/reqJ85 8fsMsQ1017Xm7C5xuWlpl1Pwb01yeZN2CDAHt+aA2r9yZCxcvwwPE46233uwt8Q7JWj1 vwLyf+GVxyXltIr7ulIgKt78ylT6vScUiBYKdeGk/fSlhrotBf9CFjZ2/pjSdsQXBdqJ 2Y38Ai7qA1UaUEnIG92axsw2IuKs/l/FK1wifqo+4/AJRRJYMf8EeV2R49xjHqxbFnF2 cFNaAaELZvtivrHF1o5EF4VibT7Y6agPR9UYUs6p9W+9Ny9qzhAvTaFxx72dKWUbaQ3a nQ7w== X-Gm-Message-State: ALoCoQl8q6WvebrZR2xz/NyL6AqFHgH1z9CFfj1nCSmjWAMiVbPMCwRK50DCgBFp/kHnAaUgaRgb X-Received: by 10.195.17.164 with SMTP id gf4mr34744349wjd.45.1403604372960; Tue, 24 Jun 2014 03:06:12 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id f6sm41768705wiy.19.2014.06.24.03.06.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jun 2014 03:06:12 -0700 (PDT) From: Thomas Monjalon To: "Chen, Jing D" Date: Tue, 24 Jun 2014 12:06:07 +0200 Message-ID: <4332738.s42vW08oSG@xps13> Organization: 6WIND User-Agent: KMail/4.13.1 (Linux/3.14.6-1-ARCH; KDE/4.13.1; x86_64; ; ) In-Reply-To: <4341B239C0EFF9468EE453F9E9F4604D01595D45@shsmsx102.ccr.corp.intel.com> References: <1403587377-10287-1-git-send-email-jing.d.chen@intel.com> <2859281.xMAtdAgJn8@xps13> <4341B239C0EFF9468EE453F9E9F4604D01595D45@shsmsx102.ccr.corp.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] i40e: fix shared code compile warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jun 2014 10:05:56 -0000 2014-06-24 09:47, Chen, Jing D: > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]=20 > > 2014-06-24 13:22, Chen Jing D: > > > +CFLAGS_i40e_lan_hmc.o +=3D -Wno-error > >=20 > > I know we shouldn't modify base drivers. But this one seems to be a= n > > important error. In such case, we already modified base driver. Rec= ently: > > http://dpdk.org/ml/archives/dev/2014-June/003498.html >=20 > I think it's different. The logic is right after adding the patch. Be= low is > my finding.=20 =20 > In this case, it met the error when compile on 32-bits OS. The messag= e is : >=20 > /jenkins/workspace/DPDK_AUTO_IDT_VM_RHEL65_32_BUILD/DPDK/lib/librte_p= md_i40e > /i40e/i40e_lan_hmc.c: In function =E2=80=98i40e_write_qword=E2=80=99:= > /jenkins/workspace/DPDK_AUTO_IDT_VM_RHEL65_32_BUILD/DPDK/lib/librte_p= md_i40 > e/i40e/i40e_lan_hmc.c:917: error: integer constant is too large for =E2= =80=98long=E2=80=99 > type > /jenkins/workspace/DPDK_AUTO_IDT_VM_RHEL65_32_BUILD/DPDK/lib/librte_p= md_i40 > e/i40e/i40e_lan_hmc.c: In function =E2=80=98i40e_read_qword=E2=80=99:= > /jenkins/workspace/DPDK_AUTO_IDT_VM_RHEL65_32_BUILD/DPDK/lib/librte_p= md_i40 > e/i40e/i40e_lan_hmc.c:1097: error: integer constant is too large for = =E2=80=98long=E2=80=99 > type=20 > I found the code that cause errors. 'mask' is 'uint64_t' type and is > assigned to value 0Xffff_ffff_ffff_ffff. Compiler assumes the constan= t is > 'int' type by default. If changed it to oxffff_ffff_ffff_ffffULL, the= > warning will be gone. =20 > =09if (ce_info->width < 64) > =09=09mask =3D ((u64)1 << ce_info->width) - 1; > =09else > =09=09mask =3D 0xFFFFFFFFFFFFFFFF; >=20 > besides that, I dis-assembler the code with the patch and get below s= egment. > It seems right.=20 =20 > if (ce_info->width < 64) > 1946: 8b 45 0c mov 0xc(%ebp),%eax > 1949: 0f b7 40 04 movzwl 0x4(%eax),%eax > 194d: 66 83 f8 3f cmp $0x3f,%ax > 1951: 77 30 ja 1983 > mask =3D ((u64)1 << ce_info->width) - 1; > 1953: 8b 45 0c mov 0xc(%ebp),%eax > 1956: 0f b7 40 04 movzwl 0x4(%eax),%eax > 195a: 0f b7 c8 movzwl %ax,%ecx > 195d: b8 01 00 00 00 mov $0x1,%eax > 1962: ba 00 00 00 00 mov $0x0,%edx > 1967: 0f a5 c2 shld %cl,%eax,%edx > 196a: d3 e0 shl %cl,%eax > 196c: f6 c1 20 test $0x20,%cl > 196f: 74 04 je 1975 > 1971: 89 c2 mov %eax,%edx > 1973: 31 c0 xor %eax,%eax > 1975: 83 c0 ff add $0xffffffff,%eax > 1978: 83 d2 ff adc $0xffffffff,%edx > 197b: 89 45 e0 mov %eax,-0x20(%ebp) > 197e: 89 55 e4 mov %edx,-0x1c(%ebp) > 1981: eb 0e jmp 1991 > else > mask =3D 0xFFFFFFFFFFFFFFFF; > 1983: c7 45 e0 ff ff ff ff movl $0xffffffff,-0x20(%ebp= ) > 198a: c7 45 e4 ff ff ff ff movl $0xffffffff,-0x1c(%ebp= ) Maybe I don't understand. You are saying you can fix the compiler warni= ng by=20 adding ULL to the constant. This is a simple patch and is a lot nicer t= han =09CFLAGS_i40e_lan_hmc.o +=3D -Wno-error Even if the asm code seems right, it would be more secure to remove thi= s=20 warning. PS: please try to configure your mailer to add citation marks. --=20 Thomas