Received: by 10.213.65.68 with SMTP id h4csp1692615imn; Mon, 26 Mar 2018 12:40:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELs+zAgi79Tt4E05u+4/ZwcTeQPddYhWAAO0pvsKt8aNZBqyTSnigZzYzH9NLysITyuCFJFT X-Received: by 10.98.71.76 with SMTP id u73mr21395523pfa.4.1522093217939; Mon, 26 Mar 2018 12:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522093217; cv=none; d=google.com; s=arc-20160816; b=n+UnPGVf+xSCL0FfWEa2GMCa/w4BC8q17ZoK1F/xYxGV9ZKmu0GpwbDQPMuF1Wnci0 ofrPVsVXwfEO1w/H440YXyB+vfijNRZAJa8FhT95hd2RxJ8qsGalDVdyB08f3lY/cCOg 6fDIExFRgsWbf/Ukyh8LPmiLFAXwvd2TYKc9a8ns8j2jiWtGm+84LOfDdxNO+ebCcB8B QXO07PccADZ+nYIr5o08bEMMPwS6OsTkTAylR5lGTmKRN8mXhAdy028XETeX6CXwNg+C VoZocn3Wk08leXMH4j4T/24RTWm+A4ydz4UqhIGoM2P662xcHYyJvSEKR7F8weZwB0At cAuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:mime-version:date:in-reply-to :subject:cc:to:from:user-agent:references:arc-authentication-results; bh=byEhzfJRoOibmLeyM0tmFeskAQbkgUWRhIsIIbRySwM=; b=m1pVNTB6PRupNOBKAhA9g8HcbsXPFsJyDbVT7q4azNUoreqQ8qzDr1m4yIcy1Zl4Tr aPYdjlg4pQHzb3N44x7Et2d5/w/PE/TjnFNP0cLHPLTAURIeTwd0E2CBWGiDOTCkcROU 1ioMvGWP4FpvT4yM9Ylv245xwoFe6qxbMUKa/fr9fk9cKBLCL1vw5aUkWH5WywieEV4N mcc/mwQWDPyMIzEPJtRDgpKzQmWP2RDu8dpScXE+93Bx6JIqAp0UBr8IPYwxCjXrKU8D 6aBwmXAaO7n7gMcXpryB/YIyWKGm+JCcAcIazQvcHP+leUDx/7x/u0jBe9Iw9wRH2AdW D8xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b125si10584749pgc.682.2018.03.26.12.40.02; Mon, 26 Mar 2018 12:40:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751686AbeCZTjK (ORCPT + 99 others); Mon, 26 Mar 2018 15:39:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49878 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751074AbeCZTjH (ORCPT ); Mon, 26 Mar 2018 15:39:07 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2QJZOvJ055026 for ; Mon, 26 Mar 2018 15:39:07 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gy4247vsa-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 26 Mar 2018 15:39:07 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 26 Mar 2018 15:39:05 -0400 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 26 Mar 2018 15:38:59 -0400 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2QJcxBD51642584; Mon, 26 Mar 2018 19:38:59 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D5D9511205F; Mon, 26 Mar 2018 15:37:52 -0400 (EDT) Received: from morokweng.localdomain (unknown [9.85.155.225]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTPS id DEACE112065; Mon, 26 Mar 2018 15:37:48 -0400 (EDT) References: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> <1519264541-7621-5-git-send-email-linuxram@us.ibm.com> <00081300-e891-3381-3acd-e3312e54fb58@intel.com> User-agent: mu4e 1.0; emacs 25.3.1 From: Thiago Jung Bauermann To: Dave Hansen Cc: Ram Pai , shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, akpm@linux-foundation.org, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, hbabu@us.ibm.com, mhocko@kernel.org, ebiederm@xmission.com, arnd@arndb.de Subject: Re: [PATCH v12 04/22] selftests/vm: typecast the pkey register In-reply-to: <00081300-e891-3381-3acd-e3312e54fb58@intel.com> Date: Mon, 26 Mar 2018 16:38:51 -0300 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 18032619-0008-0000-0000-000002EB368B X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008748; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000255; SDB=6.01008802; UDB=6.00513843; IPR=6.00788084; MB=3.00020253; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-26 19:39:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18032619-0009-0000-0000-000038B00FE8 Message-Id: <87h8p239v8.fsf@morokweng.localdomain> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-26_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803260199 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dave Hansen writes: > On 02/21/2018 05:55 PM, Ram Pai wrote: >> -static inline unsigned int _rdpkey_reg(int line) >> +static inline pkey_reg_t _rdpkey_reg(int line) >> { >> - unsigned int pkey_reg = __rdpkey_reg(); >> + pkey_reg_t pkey_reg = __rdpkey_reg(); >> >> - dprintf4("rdpkey_reg(line=%d) pkey_reg: %x shadow: %x\n", >> + dprintf4("rdpkey_reg(line=%d) pkey_reg: %016lx shadow: %016lx\n", >> line, pkey_reg, shadow_pkey_reg); >> assert(pkey_reg == shadow_pkey_reg); > > Hmm. So we're using %lx for an int? Doesn't the compiler complain > about this? It doesn't because dprintf4() doesn't have the annotation that tells the compiler that it takes printf-like arguments. Once I add it: --- a/tools/testing/selftests/vm/pkey-helpers.h +++ b/tools/testing/selftests/vm/pkey-helpers.h @@ -54,6 +54,10 @@ #define DPRINT_IN_SIGNAL_BUF_SIZE 4096 extern int dprint_in_signal; extern char dprint_in_signal_buffer[DPRINT_IN_SIGNAL_BUF_SIZE]; + +#ifdef __GNUC__ +__attribute__((format(printf, 1, 2))) +#endif static inline void sigsafe_printf(const char *format, ...) { va_list ap; Then it does complain about it. I'm working on a fix where each arch will define a format string to use for its pkey_reg_t and use it like this: --- a/tools/testing/selftests/vm/pkey-helpers.h +++ b/tools/testing/selftests/vm/pkey-helpers.h @@ -19,6 +19,7 @@ #define u32 uint32_t #define u64 uint64_t #define pkey_reg_t u32 +#define PKEY_REG_FMT "%016x" #ifdef __i386__ #ifndef SYS_mprotect_key @@ -112,7 +113,8 @@ static inline pkey_reg_t _read_pkey_reg(int line) { pkey_reg_t pkey_reg = __read_pkey_reg(); - dprintf4("read_pkey_reg(line=%d) pkey_reg: %016lx shadow: %016lx\n", + dprintf4("read_pkey_reg(line=%d) pkey_reg: "PKEY_REG_FMT + " shadow: "PKEY_REG_FMT"\n", line, pkey_reg, shadow_pkey_reg); assert(pkey_reg == shadow_pkey_reg); -- Thiago Jung Bauermann IBM Linux Technology Center