Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2232759imm; Thu, 18 Oct 2018 11:06:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV60m+gDzzrhX3iUTVrXpNoclix+wkUOl7zlocSV2pssT1sByBvimoxLEiOrnosp5+orh2ttl X-Received: by 2002:a63:754:: with SMTP id 81-v6mr2475603pgh.89.1539885996978; Thu, 18 Oct 2018 11:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539885996; cv=none; d=google.com; s=arc-20160816; b=JJ4JF18HYguUZmFtFp8kFlPnMg/v6UVeXKLRixSYCvKdqDmE03jOIWSr5VfLOIsmgw JDruZW6J3N6C2yXMKn6/Lk/lfuk1oChRuuRFQ4HEVoIDqPDymlCIcFXKvDmQJoEO+8vs hFs8Io0hxpIvCyQQwVMoChFFe+xK4xOB7H7MSoug+ABeluJfhc6UHeP2sNxVZWaYumt2 ++Yigcc/WjAGbrElmO6t+LP7VYo92dQdkKHwwVkXLfBs0D0ZnSLNVFYOhPvnm0RGWS9h Y8mN6fgJLvArnOVT2PQ6Lxw/bahwR5OET4d0PpWR0E7zekdJjTPvZz38Shflk5XRAJXQ JOOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rzXTFTSUJwOE6bwU+HRb/RDYb31xLykRMQfjGwkFI8c=; b=QXvhejUAutNmH/IE9HF3aVanBwttg2jSouk/eeBIEctQw/uQpu8B7KSHtdiqaskl27 hqjqJng0rokn8nhsFERbpzTHQFv6ifxB6Xu8tCYa5+lK321M3C0tsXX7LqqYW605G/LR SX01KWlkZRZvga9d+XICawAhrZ4yOtTxZOENo1UiRRUuSmoNVs4cmOVTsrugTUOQXTdH VZqD0SpRQZZAs7nSNOe+H2W3COMkkqy7bgGn3D8SWVH8dyU0eOdrdEOs5ipbfMCcJBbL ddUOLgPqRO0QJdGNCxTVAtNpX0oky3jtNUcJScvw9/y/5+NrLI17yyNocSxASLrrtDDg keYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C6Kb5Z1B; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12-v6si23171636pga.81.2018.10.18.11.06.21; Thu, 18 Oct 2018 11:06:36 -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; dkim=pass header.i=@kernel.org header.s=default header.b=C6Kb5Z1B; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730022AbeJSCGH (ORCPT + 99 others); Thu, 18 Oct 2018 22:06:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:54288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728416AbeJSCGG (ORCPT ); Thu, 18 Oct 2018 22:06:06 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7963A21480; Thu, 18 Oct 2018 18:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885839; bh=+qkxDcDVyd0St3cpBtBevbyUobFWnTpOlwO9jd4tO8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6Kb5Z1BRyyddTJXANySiDUu+I9ziGSBQM5EQKDZM7l0Fs493vcJljSyufBnOAXRK Bf1+irFCVH+WjwO//1RsRYORmLojekLlQVMh5EZ9qmMj3rUXgnAAApCLxj+l+njk05 kGXRPh03HcyBs095O596uLIro68+1mJ5mMFGvFog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Weisbecker , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Heiko Carstens , Martin Schwidefsky , Tony Luck , Fenghua Yu , Peter Zijlstra , Rik van Riel , Stanislaw Gruszka , Wanpeng Li , Ingo Molnar , Ivan Delalande Subject: [PATCH 4.9 31/35] macintosh/rack-meter: Convert cputime64_t use to u64 Date: Thu, 18 Oct 2018 19:55:00 +0200 Message-Id: <20181018175426.899956596@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175422.506152522@linuxfoundation.org> References: <20181018175422.506152522@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Frederic Weisbecker commit 564b733c899f4e12a64946658960fce80cad0b05 upstream. cputime_t is going to be removed and replaced by nsecs units, so convert the drivers/macintosh/rack-meter.c use to u64.. Signed-off-by: Frederic Weisbecker Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Heiko Carstens Cc: Martin Schwidefsky Cc: Tony Luck Cc: Fenghua Yu Cc: Peter Zijlstra Cc: Rik van Riel Cc: Stanislaw Gruszka Cc: Wanpeng Li Link: http://lkml.kernel.org/r/1485832191-26889-5-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar Signed-off-by: Ivan Delalande Signed-off-by: Greg Kroah-Hartman --- drivers/macintosh/rack-meter.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) --- a/drivers/macintosh/rack-meter.c +++ b/drivers/macintosh/rack-meter.c @@ -52,8 +52,8 @@ struct rackmeter_dma { struct rackmeter_cpu { struct delayed_work sniffer; struct rackmeter *rm; - cputime64_t prev_wall; - cputime64_t prev_idle; + u64 prev_wall; + u64 prev_idle; int zero; } ____cacheline_aligned; @@ -81,7 +81,7 @@ static int rackmeter_ignore_nice; /* This is copied from cpufreq_ondemand, maybe we should put it in * a common header somewhere */ -static inline cputime64_t get_cpu_idle_time(unsigned int cpu) +static inline u64 get_cpu_idle_time(unsigned int cpu) { u64 retval; @@ -91,7 +91,7 @@ static inline cputime64_t get_cpu_idle_t if (rackmeter_ignore_nice) retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; - return nsecs_to_cputime64(retval); + return retval; } static void rackmeter_setup_i2s(struct rackmeter *rm) @@ -217,23 +217,23 @@ static void rackmeter_do_timer(struct wo container_of(work, struct rackmeter_cpu, sniffer.work); struct rackmeter *rm = rcpu->rm; unsigned int cpu = smp_processor_id(); - cputime64_t cur_jiffies, total_idle_ticks; - unsigned int total_ticks, idle_ticks; + u64 cur_nsecs, total_idle_nsecs; + u64 total_nsecs, idle_nsecs; int i, offset, load, cumm, pause; - cur_jiffies = jiffies64_to_cputime64(get_jiffies_64()); - total_ticks = (unsigned int) (cur_jiffies - rcpu->prev_wall); - rcpu->prev_wall = cur_jiffies; - - total_idle_ticks = get_cpu_idle_time(cpu); - idle_ticks = (unsigned int) (total_idle_ticks - rcpu->prev_idle); - idle_ticks = min(idle_ticks, total_ticks); - rcpu->prev_idle = total_idle_ticks; + cur_nsecs = jiffies64_to_nsecs(get_jiffies_64()); + total_nsecs = cur_nsecs - rcpu->prev_wall; + rcpu->prev_wall = cur_nsecs; + + total_idle_nsecs = get_cpu_idle_time(cpu); + idle_nsecs = total_idle_nsecs - rcpu->prev_idle; + idle_nsecs = min(idle_nsecs, total_nsecs); + rcpu->prev_idle = total_idle_nsecs; /* We do a very dumb calculation to update the LEDs for now, * we'll do better once we have actual PWM implemented */ - load = (9 * (total_ticks - idle_ticks)) / total_ticks; + load = div64_u64(9 * (total_nsecs - idle_nsecs), total_nsecs); offset = cpu << 3; cumm = 0; @@ -278,7 +278,7 @@ static void rackmeter_init_cpu_sniffer(s continue; rcpu = &rm->cpu[cpu]; rcpu->prev_idle = get_cpu_idle_time(cpu); - rcpu->prev_wall = jiffies64_to_cputime64(get_jiffies_64()); + rcpu->prev_wall = jiffies64_to_nsecs(get_jiffies_64()); schedule_delayed_work_on(cpu, &rm->cpu[cpu].sniffer, msecs_to_jiffies(CPU_SAMPLING_RATE)); }