Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3400216imc; Wed, 13 Mar 2019 17:35:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/9FIr1uFLPwr9Yr81rR1WWPDEE904lL20OtFnOli4CDEb7GtA/6iVO9iZEOc4j7cPKett X-Received: by 2002:a63:f544:: with SMTP id e4mr25630764pgk.145.1552523752059; Wed, 13 Mar 2019 17:35:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552523752; cv=none; d=google.com; s=arc-20160816; b=cvnAdhrIb+46TGqqPBDFZe2AhfDzsfjkmTqQWg3Tr/mf/hM2Y+BovMiS9KGDFR49VJ 8NUghrxpbRqa472ZN/mpKVcuuSwkZXCZD+TpkNQve8cftt9dR/dtdQvfJ9tqPiE8UFQF Xm6ichjKMMWQHqqYr6HXyhYlVPi5nLW9Jn4lFQQ/bEq+8zbf2st0SlAbVUnjUW3dxRyp x0YpEyNBRVDqt9fozcCJPekz6icyyWJNVvG5B7sBWQitwJAF1WiNrdocXGaTC0PoZJJZ l8W3cK4faZCXxd2HbEqQpP2y5HWVc/m5nCfUqGQZ/9p6+o8F3WkHeHVln+Pqj16d5KUP L/mg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:openpgp:from:references:cc:to; bh=ROzdxaMJhxyjFL0japtJ7rj1P+0qGCJ+9avolipoo7I=; b=P6oLZUL78jRs43pTWKwQMFWx9B6q5Melc8o89kyNj5ANKIh3zodIdSViWTkqVlp639 p/0cy4eLJCGuIJTK71x8ttk6agQP+6U/Nuh9dB03ltZdb7rgfCnOk2d7dAbqYYXOi2/w eU/iIqr5PHWoiO+Qoiy2Tdle7IW1FIfbGHlCnjKHsSaXH+/WM7Ak/nEuZPhsPrx64IFA JrF58gSdbZBtDeKgL9PTImbrh7aYovZNNrg/G4cfyclclkDbaGuId9PVCXsGlVyctCQ/ qoh0X/HXHV7Z2BA0KNQaMqAuIvGARBgVjyM82I4SxpyfCqvttykE+HsbSUPnQjUvjOEl PbCg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ct12si13187030plb.422.2019.03.13.17.35.35; Wed, 13 Mar 2019 17:35:52 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726799AbfCNAfP (ORCPT + 99 others); Wed, 13 Mar 2019 20:35:15 -0400 Received: from mga14.intel.com ([192.55.52.115]:38516 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726512AbfCNAfO (ORCPT ); Wed, 13 Mar 2019 20:35:14 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2019 17:35:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,476,1544515200"; d="scan'208";a="151507939" Received: from schen9-desk.jf.intel.com (HELO [10.54.74.162]) ([10.54.74.162]) by fmsmga002.fm.intel.com with ESMTP; 13 Mar 2019 17:35:14 -0700 To: Aubrey Li , Subhra Mazumdar Cc: Mel Gorman , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Paul Turner , Linux List Kernel Mailing , Linus Torvalds , Fr?d?ric Weisbecker , Kees Cook , Greg Kerr References: <20190218165620.383905466@infradead.org> <20190222124544.GY9565@techsingularity.net> <14a9adf7-9b50-1dfa-0c35-d04e976081c2@oracle.com> <19d5d492-a4c1-b3c8-cae4-da2fdfcb872b@oracle.com> From: Tim Chen Openpgp: preference=signencrypt Autocrypt: addr=tim.c.chen@linux.intel.com; prefer-encrypt=mutual; keydata= mQINBE6ONugBEAC1c8laQ2QrezbYFetwrzD0v8rOqanj5X1jkySQr3hm/rqVcDJudcfdSMv0 BNCCjt2dofFxVfRL0G8eQR4qoSgzDGDzoFva3NjTJ/34TlK9MMouLY7X5x3sXdZtrV4zhKGv 3Rt2osfARdH3QDoTUHujhQxlcPk7cwjTXe4o3aHIFbcIBUmxhqPaz3AMfdCqbhd7uWe9MAZX 7M9vk6PboyO4PgZRAs5lWRoD4ZfROtSViX49KEkO7BDClacVsODITpiaWtZVDxkYUX/D9OxG AkxmqrCxZxxZHDQos1SnS08aKD0QITm/LWQtwx1y0P4GGMXRlIAQE4rK69BDvzSaLB45ppOw AO7kw8aR3eu/sW8p016dx34bUFFTwbILJFvazpvRImdjmZGcTcvRd8QgmhNV5INyGwtfA8sn L4V13aZNZA9eWd+iuB8qZfoFiyAeHNWzLX/Moi8hB7LxFuEGnvbxYByRS83jsxjH2Bd49bTi XOsAY/YyGj6gl8KkjSbKOkj0IRy28nLisFdGBvgeQrvaLaA06VexptmrLjp1Qtyesw6zIJeP oHUImJltjPjFvyfkuIPfVIB87kukpB78bhSRA5mC365LsLRl+nrX7SauEo8b7MX0qbW9pg0f wsiyCCK0ioTTm4IWL2wiDB7PeiJSsViBORNKoxA093B42BWFJQARAQABtDRUaW0gQ2hlbiAo d29yayByZWxhdGVkKSA8dGltLmMuY2hlbkBsaW51eC5pbnRlbC5jb20+iQI+BBMBAgAoAhsD BgsJCA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bnt5QDk l50q2K/r651xphs7CGEdKi1nU0YJVbQxJQ== Subject: Re: [RFC][PATCH 00/16] sched: Core scheduling Message-ID: <8098aac2-60f7-6fe9-2a3a-2fe2e1b49bde@linux.intel.com> Date: Wed, 13 Mar 2019 17:35:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> >> One more NULL pointer dereference: >> >> Mar 12 02:24:46 aubrey-ivb kernel: [ 201.916741] core sched enabled >> [ 201.950203] BUG: unable to handle kernel NULL pointer dereference >> at 0000000000000008 >> [ 201.950254] ------------[ cut here ]------------ >> [ 201.959045] #PF error: [normal kernel read fault] >> [ 201.964272] !se->on_rq >> [ 201.964287] WARNING: CPU: 22 PID: 2965 at kernel/sched/fair.c:6849 >> set_next_buddy+0x52/0x70 > > A quick workaround below: > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 1d0dac4fd94f..ef6acfe2cf7d 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6834,7 +6834,7 @@ static void set_last_buddy(struct sched_entity *se) > return; > > for_each_sched_entity(se) { > - if (SCHED_WARN_ON(!se->on_rq)) > + if (SCHED_WARN_ON(!(se && se->on_rq)) > return; > cfs_rq_of(se)->last = se; > } > @@ -6846,7 +6846,7 @@ static void set_next_buddy(struct sched_entity *se) > return; > > for_each_sched_entity(se) { > - if (SCHED_WARN_ON(!se->on_rq)) > + if (SCHED_WARN_ON(!(se && se->on_rq)) Shouldn't the for_each_sched_entity(se) skip the code block for !se case have avoided null pointer access of se? Since #define for_each_sched_entity(se) \ for (; se; se = se->parent) Scratching my head a bit here on how your changes would have made a difference. In your original log, I wonder if the !se->on_rq warning on CPU 22 is mixed with the actual OOPs? Saw also in your original log rb_insert_color. Wonder if that was actually the source of the Oops? [ 202.078674] RIP: 0010:set_next_buddy+0x52/0x70 [ 202.090135] Hardware name: Intel Corporation S2600CP/S2600CP, BIOS SE5C600.86B.99.99.x058.082120120902 08/21/2012 [ 202.090144] RIP: 0010:rb_insert_color+0x17/0x190 [ 202.101623] Code: 48 85 ff 74 10 8b 47 40 85 c0 75 e2 80 3d 9e e5 6a 01 00 74 02 f3 c3 48 c7 c7 5c 05 2c 82 c6 05 8c e5 6a 01 01 e8 2e bb fb ff <0f> 0b c3 83 bf 04 03 0e [ 202.113216] Code: f3 c3 31 c0 c3 0f 1f 40 00 66 2e 0f 1f 84 00 00 00 00 00 48 8b 17 48 85 d2 0f 84 4d 01 00 00 48 8b 02 a8 01 0f 85 6d 01 00 00 <48> 8b 48 08 49 89 c0 44 [ 202.118263] RSP: 0018:ffffc9000a5cbbb0 EFLAGS: 00010086 [ 202.129858] RSP: 0018:ffffc9000a463cc0 EFLAGS: 00010046 [ 202.135102] RAX: 0000000000000000 RBX: ffff88980047e800 RCX: 0000000000000000 [ 202.135105] RDX: ffff888be28caa40 RSI: 0000000000000001 RDI: ffffffff8110c3fa [ 202.156251] RAX: 0000000000000000 RBX: ffff888bfeb80000 RCX: ffff888bfeb80 Thanks. Tim