Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1683726pxa; Thu, 13 Aug 2020 14:47:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLs3ssc5oiWJrFvDqMAU5dy88qgtgCCwegH5y5GLbtgP4Y2yMbBYYnTsznT8R+Q8AYW0K7 X-Received: by 2002:a17:906:4d4f:: with SMTP id b15mr6638024ejv.534.1597355231035; Thu, 13 Aug 2020 14:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597355231; cv=none; d=google.com; s=arc-20160816; b=fStSsf+Mb5f+CVXeY8KyyG0mI8LeMmyZoXkhtfONLzoED7QVGbO0ptQB8DObytw55X xjJ0ZnBlaQsjjrGhtBtGft3RxhxAavJkT5W3fPGC86rqPYsH9OueVcx6lVoLNovMNGZ5 xv1zn29Rav9XNn8D4gvs3ZkqY76pTvV4xfvReFQiQM6MBL3092Ygqh4CiGFXMNN1XKAn QA7WjS+ov3fSBb0mCDUtET3MvI4Ym7Xa3OW9ptcCaaXcTsrWezZy21Qc9p6wfX/gdyby D2aQEU48UtrCqJmZROxWkTYV3AGHWuy5EIXAHim5CHCgsoryMaC8o5SGFf/O8tF7IDCU hPRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=P2eZuP6c506YZ5zFEOeI1NqJOh6HdWASDT5YVO36Yfc=; b=sElWiuSka3r6u9xyNUTj4tqUraqklfH5K7SoP2bQRR4hLt04jJjxvl5CsdNocTD1Ae j8ylM0H8qLfrWj94K9u74HDSHNFy/Is3meZKZygoND/jhdXZPt5pLXWcdGBP9+OCWgFm iQbpvP2Nd+J2kWPVLE2ZGcFRjGMxQOBRj+4HZviWfzteuBe7YvZ2lgDkZOQd+I/LrKVQ m3euFVasVqZ8FHLQHTJGilPun9ngPjpMA7e023t3RYONwgkEcLEieKb0nxWzI1T4Ysjl lO6twE3FD7fLX46oefgKuI2TVavzNXIc5Qsv8DySIp89xD9m0Bjouzigm5ylV7Qa4Ufm G4Ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si4014204ejg.156.2020.08.13.14.46.43; Thu, 13 Aug 2020 14:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726533AbgHMVni (ORCPT + 99 others); Thu, 13 Aug 2020 17:43:38 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45569 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbgHMVni (ORCPT ); Thu, 13 Aug 2020 17:43:38 -0400 Received: by mail-ed1-f66.google.com with SMTP id di22so5305688edb.12; Thu, 13 Aug 2020 14:43:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P2eZuP6c506YZ5zFEOeI1NqJOh6HdWASDT5YVO36Yfc=; b=MXxoEzbv/R7sMMN1okBlMNVuvbdhbtqaSV82wFn9kzSHk3SCKfKKMtufntnxyb7VP1 7KRWjlR28PLzL+glBKTaR0Yeir9jOOOOSlbk92Zn3JnKcmbWB72KCG/xQ0zDMRkac070 vi/QyfVnQI5kzQLlt9NICAUE2JomaNhnFhqPS7+KaPb64QCT8D9hefmED0bDJsW/cJBP cYSKuGE4p8PlXcXoyfFiK8U1vcfn6E0HOnBdRv4CmtV+8s2t412kAQO+uO8Xb7FmQZbj 2/2n5KoMoJvYvdgahO8o1JWOKy1Uhk4QuK859H/7rNTmdw/HkAVXNi36lWuSDP+O+egH lQKA== X-Gm-Message-State: AOAM533cPProeDKbAmEDXSOc6ScGKoiEPg1qgjsvnn6CvU2tGcxW/isX g290+AbWyPyHHmgIHvamVqTcbomGT12EI0i78zU= X-Received: by 2002:a50:af86:: with SMTP id h6mr6825875edd.132.1597355016709; Thu, 13 Aug 2020 14:43:36 -0700 (PDT) MIME-Version: 1.0 References: <20200717060849.12469-1-liwei.song@windriver.com> In-Reply-To: <20200717060849.12469-1-liwei.song@windriver.com> From: Len Brown Date: Thu, 13 Aug 2020 17:43:25 -0400 Message-ID: Subject: Re: [PATCH] tools/power turbostat: call pread64 in kernel directly To: Liwei Song Cc: Linux PM list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Huh? On Fri, Jul 17, 2020 at 2:09 AM Liwei Song wrote: > > with 32-bit rootfs, the offset may out of range when set it > to 0xc0010299, define it as "unsigned long long" type and > call pread64 directly in kernel. > > Signed-off-by: Liwei Song > --- > tools/power/x86/turbostat/turbostat.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c > index 33b370865d16..4c5cdfcb5721 100644 > --- a/tools/power/x86/turbostat/turbostat.c > +++ b/tools/power/x86/turbostat/turbostat.c > @@ -33,6 +33,7 @@ > #include > #include > #include > +#include > > char *proc_stat = "/proc/stat"; > FILE *outf; > @@ -381,11 +382,11 @@ int get_msr_fd(int cpu) > return fd; > } > > -int get_msr(int cpu, off_t offset, unsigned long long *msr) > +int get_msr(int cpu, unsigned long long offset, unsigned long long *msr) > { > ssize_t retval; > > - retval = pread(get_msr_fd(cpu), msr, sizeof(*msr), offset); > + retval = syscall(SYS_pread64, get_msr_fd(cpu), msr, sizeof(*msr), offset); > > if (retval != sizeof *msr) > err(-1, "cpu%d: msr offset 0x%llx read failed", cpu, (unsigned long long)offset); > -- > 2.17.1 > -- Len Brown, Intel Open Source Technology Center