Received: by 10.223.185.116 with SMTP id b49csp7200053wrg; Thu, 1 Mar 2018 01:19:18 -0800 (PST) X-Google-Smtp-Source: AG47ELuc3taU4e+9jMXC1RVx5wPyRqlGn7O1BRi/gxMT93PFC5pJUH2yYq7IeGBnM7duUriW9Ea5 X-Received: by 2002:a17:902:be14:: with SMTP id r20-v6mr1341155pls.172.1519895957947; Thu, 01 Mar 2018 01:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519895957; cv=none; d=google.com; s=arc-20160816; b=HXCN7hyteN7PfAsnhoG2uHpQ60l4taAQO0fsz20wTr1wE3NImBFzoDBZIzCAcZPgFB ID3llW+vZdKcZOJPsMcDCJL0uAcL8+SUCuiwPvodJeju1syDPTpCr500JmR5K7kO7C8w dAq5DGO4giXIAXqSDDfbzLC2EIGIdqxwdyXvkia/Uc/xl/NnwkqNFZLkCYUUNpRhit/y OdOga63lF2crFsPv4iAcKuqv5TxVRtdpUbkICQCa/MaDh3/+S4L5boNogR1IvGriN0MZ 9dlAz1uSB3HMR18a69ba5HmQTXaA0yE1++oXHPYjpjzvRGFGrYtrm79SnmZHDcaLJmLT jK+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=97j1qLpHBm+DMEuNVzPByv0GCncpkHrvQ49OrNAta74=; b=LINT5wHT5/mBzpdOg6z91r6hECX4+CuCk//vbBwOVItzguwqk2RFlag0gm5FDK66BB 6Tkxuo3aIOlAXDvQQQddD834LQnq0q+TK/BrFdk8Ym6EsnGQv9OrBpaG8XuZDqQCRPOb XdgJ5BY86qlXf9UclBJWSS0DdP8uI+6aFoTZbSnj0uB+hELEHB9qWTzpX2USfuM2UxmE GWUlwKWcpS6E5KBthq3VM8Dc7rIRc+Z+kf/bBEI4/kBEHg1Ka3480ACErIASU6K3R83v DEgU+NXpwg09sWHbAgSE1leC0wHC0TWeKhK7qNkbPg7wSv088oCSIjvKnJoX6Tnt3Rdy ZsYA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12-v6si2844720plx.355.2018.03.01.01.19.03; Thu, 01 Mar 2018 01:19:17 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966856AbeCAJRL (ORCPT + 99 others); Thu, 1 Mar 2018 04:17:11 -0500 Received: from terminus.zytor.com ([198.137.202.136]:44593 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966724AbeCAJRI (ORCPT ); Thu, 1 Mar 2018 04:17:08 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w219H1Zq009310; Thu, 1 Mar 2018 01:17:01 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w219H0sv009306; Thu, 1 Mar 2018 01:17:00 -0800 Date: Thu, 1 Mar 2018 01:17:00 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Dou Liyang Message-ID: Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, andy.shevchenko@gmail.com, hpa@zytor.com, douly.fnst@cn.fujitsu.com Reply-To: linux-kernel@vger.kernel.org, mingo@kernel.org, douly.fnst@cn.fujitsu.com, tglx@linutronix.de, hpa@zytor.com, andy.shevchenko@gmail.com In-Reply-To: <20180301055930.2396-3-douly.fnst@cn.fujitsu.com> References: <20180301055930.2396-3-douly.fnst@cn.fujitsu.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/apic] x86/apic: Modernize the pending interrupt code Git-Commit-ID: 3ea9e7ae1a2038b9fdff729861c9b4af0087024f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3ea9e7ae1a2038b9fdff729861c9b4af0087024f Gitweb: https://git.kernel.org/tip/3ea9e7ae1a2038b9fdff729861c9b4af0087024f Author: Dou Liyang AuthorDate: Thu, 1 Mar 2018 13:59:29 +0800 Committer: Thomas Gleixner CommitDate: Thu, 1 Mar 2018 10:12:20 +0100 x86/apic: Modernize the pending interrupt code The pending interrupt check code is old, update the following: - Use for_each_set_bit() instead of open coding it - Replace printk() with pr_err() - Get rid of printk line breaks - Make curly braces balanced Suggested-by: Andy Shevchenko Signed-off-by: Dou Liyang Signed-off-by: Thomas Gleixner Reviewed-by: Andy Shevchenko Cc: bhe@redhat.com Cc: ebiederm@xmission.com Link: https://lkml.kernel.org/r/20180301055930.2396-3-douly.fnst@cn.fujitsu.com --- arch/x86/kernel/apic/apic.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 69d2936e3154..7a347d7450b6 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1412,7 +1412,8 @@ static void apic_pending_intr_clear(void) { long long max_loops = cpu_khz ? cpu_khz : 1000000; unsigned long long tsc = 0, ntsc; - unsigned int value, queued; + unsigned int queued; + unsigned long value; int i, j, acked = 0; if (boot_cpu_has(X86_FEATURE_TSC)) @@ -1435,24 +1436,22 @@ static void apic_pending_intr_clear(void) for (i = APIC_ISR_NR - 1; i >= 0; i--) { value = apic_read(APIC_ISR + i*0x10); - for (j = 31; j >= 0; j--) { - if (value & (1< 256) { - printk(KERN_ERR "LAPIC pending interrupts after %d EOI\n", - acked); + pr_err("LAPIC pending interrupts after %d EOI\n", acked); break; } if (queued) { if (boot_cpu_has(X86_FEATURE_TSC) && cpu_khz) { ntsc = rdtsc(); max_loops = (cpu_khz << 10) - (ntsc - tsc); - } else + } else { max_loops--; + } } } while (queued && max_loops > 0); WARN_ON(max_loops <= 0);