Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934311AbcLMTMu (ORCPT ); Tue, 13 Dec 2016 14:12:50 -0500 Received: from mail-db5eur01on0096.outbound.protection.outlook.com ([104.47.2.96]:60779 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752826AbcLMTMs (ORCPT ); Tue, 13 Dec 2016 14:12:48 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Subject: Re: [PATCH] mm-add-vfree_atomic-fix To: Michal Hocko , Andy Lutomirski References: <87lgvlzp34.fsf@yhuang-dev.intel.com> <1481553981-3856-1-git-send-email-aryabinin@virtuozzo.com> <20161213101254.GC10498@dhcp22.suse.cz> <20161213172441.GA22610@dhcp22.suse.cz> CC: Andrew Morton , Huang Ying , Stephen Rothwell , Christoph Hellwig , Joel Fernandes , Jisheng Zhang , Chris Wilson , John Dias , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , "linux-kernel@vger.kernel.org" , LKP From: Andrey Ryabinin Message-ID: Date: Tue, 13 Dec 2016 22:06:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161213172441.GA22610@dhcp22.suse.cz> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [84.47.128.244] X-ClientProxiedBy: HE1PR0101CA0013.eurprd01.prod.exchangelabs.com (10.168.141.151) To DB6PR0801MB2053.eurprd08.prod.outlook.com (10.168.86.22) X-MS-Office365-Filtering-Correlation-Id: 2c517abd-85a8-4245-c5b6-08d4238c04e8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB6PR0801MB2053; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2053;3:TZa3UQB3cXnCpKvPeLM7GFqe5tjq4Ua3Jd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p9wEDgxxEL4v7/72/DdNTvNRI9IQV49rD1KOgRszpJn+uHEMlZfAI+PMdxo1APe2mQsFaX74gVYu0FOSVgTgeq2+v1fWK X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2053;31:TXNTOMbcbTWoqCbSq08jLOfF6S9EGCTebOLjW08v9iC25xPg6dmlftWoKPVrLxAbmhimhvTyZyB1pjJ9z4C49JobB/RUovuz41BB4CKYOvEWnsxZo1jWCUye+FJxxFpBesCHxQz1X5W8jjdXqdlvFR4bXm4bA4RlTBGWAf59LQkuum5AOsW2R6Vjg4UWQTptwhDutRwnkdU/UJSXTt9eJbbtn3ufwxcgj0bn3U0kKNvczzGZjuVCdOx4FbqY+AAfGU1D7ojWYIKPSOrIkLhBtQ==;20:n7D2m3jKBcfS1P+wPZdvsOPpEl7MYLqRogT4Pv1nDZtkLyFBnUELaKdRHVUeJxiHbIZklcgEliYAoSb4KrHDlnTqeY8OjKygfudpe1vELhJ1ZuAHumsQTuatKk0D/cldG3SBp8tuthhhMvysUlqIHOS30fV3xg9W/tnA9PTVh1OwrIkH+U1gItx1rmWtkkDJgVJCtRoHxeGKABQM+qERnMKVx7vr6cWqkF3/HEvTrlk+HIGWVeH/S6qDiP04GMk1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42068640409301)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148);SRVR:DB6PR0801MB2053;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB2053; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2053;4:Aag5PppcFf7dF35vV9vizr0at4m84tiHD3qUK28clO34iRliiumQL9r+ChP7c7pRJI/PNNQE/7WZwhdZoqS9pum6Srt6PJFm3+K4IoqOb1l8ALINKofPhk/12piVgEhwRMqEv67IIcfZxE6mUTdWWJrH87Qglwh58ng1Ic9bUcnp07P1Y2INRe6B+jOGtcdACCeU1hn76K13kGH8uvoszgFwI09cScaueNpb/HUP752UTumKbSApt4zxO+rFRkuZo8WUrST1Uira2JuoOiSds9ExQZgMEdz3xMAqEj1Zl+n/CdQjYWcn6UDqcJoMuWcogt6TP0fGI0rHn9IcTqj3KXf3RQQCdNO7Qfm4xuM5ImzATs0nOJwjsc5ZMoxpTzxp6ikL93vECTmuQQ2+d0HPNr1GIWwF3nPzTlI8trVVP0ADBpi9NENihe0ziLpy8K4O6OKvsG2M6CrJhyUS4nrMMuBqshmrKJQ+ZkrZNk84X+6oBKEa22UaVFZI65eXMbqJi73E1roCPbRu91MhrJBCiLAIyqTFRvpXbqn6wUOl11wFjTMGs2fX1CZJ0q3Q3habv2dm92oDAY4SaAkdZGkEeoWH653qWue+AMlLIS6gu6Sr8TOzDqDIk3MZYjDezgJs/5NUJ41IyAhdJQaUCz23JA== X-Forefront-PRVS: 01559F388D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(39450400003)(377454003)(377424004)(52314003)(199003)(24454002)(189002)(55674003)(5001770100001)(54356999)(106356001)(7736002)(90366009)(31696002)(189998001)(105586002)(101416001)(86362001)(97736004)(38730400001)(8676002)(81166006)(81156014)(77096006)(65956001)(76176999)(66066001)(6116002)(3846002)(93886004)(6486002)(33646002)(23746002)(65806001)(47776003)(229853002)(7416002)(4001350100001)(31686004)(42186005)(50986999)(6666003)(68736007)(230783001)(5660300001)(2950100002)(92566002)(83506001)(230700001)(2906002)(4326007)(50466002)(64126003)(305945005)(36756003)(65826007);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB2053;H:[10.52.82.3];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB6PR0801MB2053;23:nF8Bn8emjW7I/h4styhxqHG0IIl7+0Kn1wQ?= =?Windows-1252?Q?TLB5AfMcg+1K8Yf5Te0EkZO8iYTfBL9aA2W93M1n47CRfyt8IWtTeiAe?= =?Windows-1252?Q?YasRvO6Y6wqcXTJXxmWjhntQrk+X5R43bM7Em56CdTpf4gxzYYBZvO3G?= =?Windows-1252?Q?SA9bvj62bKm01i67/S2UJETJ+2ypky0vLkOBxl2gAwUOJOuRNO/fOMtu?= =?Windows-1252?Q?6KTpu25OD3Rh6fLuyuS8kmd/INTMpTwkmNhg415lMFRjw+eezROSg+s5?= =?Windows-1252?Q?UucmfSFDX9Ybvm7/VmPDTY6oBEl3SRENgNphLdrFselODcZ8dgTSmpB6?= =?Windows-1252?Q?4xRevLZVXPTDDItpKRHPEhN70PPz4HWABupDlvgHLttlx3NTiVS3eZfQ?= =?Windows-1252?Q?gSrkEB/yFfmHVPbYZRGCxgzOwRIqDolIJYru6kEa6OzTJorPu6Ra67HK?= =?Windows-1252?Q?duGfWt5rilUKYaVuNEocW816vzY32IM8HTBJ1RiQDN0TXqeO9fJAbIWH?= =?Windows-1252?Q?G9vrdGNko2OcOcxhCA7OQuuEocQdKX9Xs2z1D/FoKoOMWHtvC4Vke9zw?= =?Windows-1252?Q?ZaGhlOkXQy2xPepM/Gwb9mVMZcCKq/cMspPXpgCGPrTVndT/ypdUevH6?= =?Windows-1252?Q?oflcnjL+QA9d3BP4LxfLwFwW3oD1X1czuRXrE3YoFb77QOYYiJCisFeS?= =?Windows-1252?Q?C0FUtNADIrONQCIFJFJWy9YoseTP25/U+fBAPjYDJ7I/rR4P+8ChQO16?= =?Windows-1252?Q?U6PmOlhV6+VJfferRKFbZhA09FcM98n8AlzUz1fNHACysX2cVYs5eJjH?= =?Windows-1252?Q?QjLGolJiSTz/ag5GxMeMI+pAZlxPx+n1G3/vncWfsTig7qKwAOwznqf7?= =?Windows-1252?Q?foNnTISgVoL5sbUzF1lnU9lsgCIjZPeWXyTvvTNe2wbiUn3iJUatSZ68?= =?Windows-1252?Q?DFcWxCn+Vps0ZaH67irE+DtCaHavna/JladLKEkWytXryQwJIA95Y9dX?= =?Windows-1252?Q?VsxL0x6FzMEIp8h7cjdfWGY66vi0EMEM200lnnUginy3hKdtwCJWF1ys?= =?Windows-1252?Q?955lQJrUq4pwckk8+Ic3Z/LYNK9kkpw9oWUw1HxTPLI+sogbB0pZzbjP?= =?Windows-1252?Q?KUNWbmm2zCMHd3K15jIHsFItxQjhCZ3b9WX7coDzEx+wJ8OrHHD/YQ8Q?= =?Windows-1252?Q?mswRLq7+nzsit/a4qoKvnpwfWz4fdkZu7gcYLg2RrAGJ+v6VH9CVbFrU?= =?Windows-1252?Q?XzBqUZT06GB0nSbXpa5smO/wBE61znUHgjvV+JG7BYuOj2Jhm8xCSFEI?= =?Windows-1252?Q?QjiqGgAL9fchVzZaMnmS46K9pt31mFXCYNIk0XblO67xPKhBHZthmNrP?= =?Windows-1252?Q?g0R0zwEWcKD8P+Vb9Q94rASwWUjHWHPE6Pb1DfZiclS+qP0+fUaliQbS?= =?Windows-1252?Q?uE2kalh455SIevGU6JWOxIiE+pIJQPSy1h5IuJkK1BsVhxiKSRQRcHh/?= =?Windows-1252?Q?eS1FOPjUNbwLUCNWSmuwI05iZ0HCEd73noLeq76PLo55Cbfdgng53BhQ?= =?Windows-1252?Q?UDWehOjvXXzj1C6M=3D?= X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2053;6:YvSdSv6OP9ya6DoPLd/lSv2ZZ0Mw+qJ14Gw9D3kU5yr/R5qUCvLz/jFvNKs+dMw7ag/1kMg7V/+u6j3ULyQQlLEctobYTPdCkQTK88MzvTmo7FawW5CyXEX4uhelf9jpgOSPnCW6c8/z5tbYL0+3Ek08knYB7G/oTVJpN/aKk69UzrKLPUKcqvjV+zlAMfLp5Nqb2DI1uOhMS4PozuAxg+hQWmxqjVpfUV7x14FaqFFIsrZuk8XgNQSPW4rCRCtbieFY2c9nOIDo3bmWsKFFFM4NR30+WZZa1WwUJvDNmy1dKbHHcUDQo2Q2UqRIOT9sd5bUuXE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GnoMQuxWux0MhKbbEdvXY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 19:12:42.4878 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2053 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3459 Lines: 69 On 12/13/2016 08:24 PM, Michal Hocko wrote: > On Tue 13-12-16 08:57:34, Andy Lutomirski wrote: >> On Tue, Dec 13, 2016 at 2:12 AM, Michal Hocko wrote: >>> [CC Andy] >>> >>> I've noticed the same >>> http://lkml.kernel.org/r/20161209142820.GA4334@dhcp22.suse.cz >>> and also concluded same as you >>> >>> On Mon 12-12-16 17:46:21, Andrey Ryabinin wrote: >>>> DEBUG_PREEMPT complains about using this_cpu_ptr() in preemptible: >>>> BUG: using smp_processor_id() in preemptible [00000000] code: iperf-300s-cs-l/277 >>>> caller is debug_smp_processor_id+0x17/0x19 >>>> CPU: 1 PID: 277 Comm: iperf-300s-cs-l Not tainted 4.9.0-rc8-00140-gcc639db #2 >>>> ffffc900003f3cf0 ffffffff8123ae6f 0000000000000001 ffffffff818181da >>>> ffffc900003f3d20 ffffffff81252f41 0000000000012de0 00000000fffffdff >>>> ffff880009328f40 ffff88000592c400 ffffc900003f3d30 ffffffff81252f6a >>>> Call Trace: >>>> [] dump_stack+0x9a/0xd0 >>>> [] check_preemption_disabled+0xdd/0xef >>>> [] debug_smp_processor_id+0x17/0x19 >>>> [] __vfree_deferred+0x16/0x4c >>>> [] vfree_atomic+0x22/0x24 >>>> [] free_thread_stack+0xc2/0x106 >>>> [] put_task_stack+0x4c/0x62 >>>> [] copy_process+0x7e0/0x16e8 >>>> [] _do_fork+0xbb/0x2d3 >>>> [] ? __do_page_fault+0x2e1/0x384 >>>> [] ? trace_hardirqs_off_caller+0x12/0x24 >>>> [] SyS_clone+0x19/0x1b >>>> [] do_syscall_64+0x143/0x173 >>>> [] entry_SYSCALL64_slow_path+0x25/0x25 >>>> >>>> Use raw_cpu_ptr() instead of this_cpu_ptr() to hide this warning. >>>> It's fine because llist_add() implementation is lock-less, so it works even >>>> if we adding to the list of some other cpu. schedule_work() is also preempt-safe. >>>> >>>> Reported-by: kernel test robot >>>> Signed-off-by: Andrey Ryabinin >>> >>> Acked-by: Michal Hocko >> >> But not quite acked by me. What happened to the vfree code that >> causes vfree_deferred to be called in a preemptable context? That >> sounds like a bug. > > Not sure I understand but the above stack points to a preemptible > context (copy_process). My stack was different and it looks preemptible as well. > free_thread_stack calls vfree_atomic unconditionally. So I am not sure > why do you think this is a bug? > >> (This code doesn't exist in Linus' tree. What tree does this apply to.) > > Anyway, now that I am looking at Andrew's tree I can see [1] which > doesn't have this_cpu_ptr. So I am not sure where this this_cpu_ptr came > from. Maybe the previous version of the patch which has shown up in the > linux-next and Andrew has picked up [2] in the meantime. /me confused > this_cpu_ptr() comes from the original patch http://lkml.kernel.org/r/1479474236-4139-5-git-send-email-hch@lst.de Andrew picked up [2] and folded-merged it into original patch and sent it to Linus. Now it in Linus tree, commit bf22e37a641327e34681b7b6959d9646e3886 > [1] http://www.ozlabs.org/~akpm/mmotm/broken-out/mm-add-vfree_atomic.patch > [2] http://lkml.kernel.org/r/1481553981-3856-1-git-send-email-aryabinin@virtuozzo.com >