Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2974150imu; Sun, 9 Dec 2018 14:03:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/VtfljO6TXJnWmoMVWpECrmn5YIJlwuoLGfm1fO9qpG6fjm0dF1/G4eV6kAh/8PE6CgGyrk X-Received: by 2002:a63:d34a:: with SMTP id u10mr8948374pgi.301.1544393018694; Sun, 09 Dec 2018 14:03:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544393018; cv=none; d=google.com; s=arc-20160816; b=tw3B8Kq96g5Wp5WRkkVMCYqfjpLtF4LSLu/+vZjAoMLYFZQ0MChT6veQeLiDVs1GkN 29Ci8wQy961BFrTSwsMSo8TsUM3bUSRA1H+2+BdMpOr8TtODBbg8Ua5f2xS7VBN+g8ZM J0xjsO56+EY23Bt/s+2I2qxLhZ5Hje9fkAhZ4ymSnduKrTqtRh3qDxwUze0PvJsraEId r+PR8+mP+qAtrLCxGkTWnsGv9n1l+e+YUun7eGhV+1DTlUL+vz7mAu94yBsFK2OPSsRi jWRWYGB0mEC0cDx8yF2Uz18T9O6SQFxD1F6o//rmXLGy0OcZNJJ9RDgrAUN5IgwITmRc BGTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=nCTH3xa88IWdeMtKPVu1kp0yif6G0quvz5L9Q0FCDyw=; b=0K/U/mdA2lSw057s4f1+pWytcOOFczgmHycZ+/3BxOW1AO8I1SDNamXEDSV1yOB/ao jx2JVnmbi8SU65ZNwcowtEnci58u3xFM+AW/yYEQO5oKUu+PW1YNqVJF28s/zXLVWtAK w9ZrOVjRw5C7D8qZ3Y9xv/Oc6eyqFePfzuHL+9S2IP+5I2MGp9HcwGT7ky8fSbPcHJxd cnGKAHYe0UeVDZwH5gd1kpXJ1mAYDW/AcQccq0NtsxW0p9vp+SAUcHf0bD+klu8pm1iY Xr6J/DvAZjiAeNMoVzXjF0YmIJ1bnoSuBh2qw6vgU/yl2mVdfax4+qgS33wCi+6kXXlt cmuA== 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 m64si9421535pfb.224.2018.12.09.14.03.23; Sun, 09 Dec 2018 14:03:38 -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 S1726829AbeLIWAy (ORCPT + 99 others); Sun, 9 Dec 2018 17:00:54 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35992 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726694AbeLIVze (ORCPT ); Sun, 9 Dec 2018 16:55:34 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW72x-0002io-E2; Sun, 09 Dec 2018 21:55:31 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72j-0003bI-2f; Sun, 09 Dec 2018 21:55:17 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Michael Bringmann" , "Michael Ellerman" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 261/328] powerpc/pseries: Fix unitialized timer reset on migration In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Michael Bringmann commit 8604895a34d92f5e186ceb931b0d1b384030ea3d upstream. After migration of a powerpc LPAR, the kernel executes code to update the system state to reflect new platform characteristics. Such changes include modifications to device tree properties provided to the system by PHYP. Property notifications received by the post_mobility_fixup() code are passed along to the kernel in general through a call to of_update_property() which in turn passes such events back to all modules through entries like the '.notifier_call' function within the NUMA module. When the NUMA module updates its state, it resets its event timer. If this occurs after a previous call to stop_topology_update() or on a system without VPHN enabled, the code runs into an unitialized timer structure and crashes. This patch adds a safety check along this path toward the problem code. An example crash log is as follows. ibmvscsi 30000081: Re-enabling adapter! ------------[ cut here ]------------ kernel BUG at kernel/time/timer.c:958! Oops: Exception in kernel mode, sig: 5 [#1] LE SMP NR_CPUS=2048 NUMA pSeries Modules linked in: nfsv3 nfs_acl nfs tcp_diag udp_diag inet_diag lockd unix_diag af_packet_diag netlink_diag grace fscache sunrpc xts vmx_crypto pseries_rng sg binfmt_misc ip_tables xfs libcrc32c sd_mod ibmvscsi ibmveth scsi_transport_srp dm_mirror dm_region_hash dm_log dm_mod CPU: 11 PID: 3067 Comm: drmgr Not tainted 4.17.0+ #179 ... NIP mod_timer+0x4c/0x400 LR reset_topology_timer+0x40/0x60 Call Trace: 0xc0000003f9407830 (unreliable) reset_topology_timer+0x40/0x60 dt_update_callback+0x100/0x120 notifier_call_chain+0x90/0x100 __blocking_notifier_call_chain+0x60/0x90 of_property_notify+0x90/0xd0 of_update_property+0x104/0x150 update_dt_property+0xdc/0x1f0 pseries_devicetree_update+0x2d0/0x510 post_mobility_fixup+0x7c/0xf0 migration_store+0xa4/0xc0 kobj_attr_store+0x30/0x60 sysfs_kf_write+0x64/0xa0 kernfs_fop_write+0x16c/0x240 __vfs_write+0x40/0x200 vfs_write+0xc8/0x240 ksys_write+0x5c/0x100 system_call+0x58/0x6c Fixes: 5d88aa85c00b ("powerpc/pseries: Update CPU maps when device tree is updated") Signed-off-by: Michael Bringmann Signed-off-by: Michael Ellerman [bwh: Backported to 3.16: Also remove direct assignment to topology_timer.expires, done upstream as part of commit df7e828c1b69 "timer: Remove init_timer_deferrable() in favor of timer_setup()"] Signed-off-by: Ben Hutchings --- arch/powerpc/mm/numa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -1654,8 +1654,8 @@ static struct timer_list topology_timer static void reset_topology_timer(void) { topology_timer.data = 0; - topology_timer.expires = jiffies + 60 * HZ; - mod_timer(&topology_timer, topology_timer.expires); + if (vphn_enabled) + mod_timer(&topology_timer, jiffies + 60 * HZ); } #ifdef CONFIG_SMP