Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3902971ybz; Mon, 4 May 2020 11:50:15 -0700 (PDT) X-Google-Smtp-Source: APiQypL7bLwn7Kj1Sk+JgV2IW1OBTMI/ClJwwbQqKQzU/l+zkNqElQD4dlqepiVseuSCVARobRBX X-Received: by 2002:a50:eb8e:: with SMTP id y14mr15773320edr.270.1588618215103; Mon, 04 May 2020 11:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588618215; cv=none; d=google.com; s=arc-20160816; b=sOXohp+G3BMTq0VxM8JN3firAsOgvIsSVyUeYp26ukfCa1Jp10+GvP8qgoOBB+OY4n 3QzCRHcbzofLANzP4VGgPoIkNtVoMZhh+AIRd3wCZx4qSRQdRCjoJ63NoARhIXerMPDA qRttQOjb5lA9rzaIub8C/UPPQelgM2v65Us9MdD8g7AOfRr53XOvXlUaWCXMR1wAZVq4 770Q3qjUxK6v1a4Y3Hf5mFW6tVJCWnAb/xLPZKSqSuuiybZe4jXztJOQvLKJTr3ficYj 3mKgZsA6Y86tGY1hKDeTQ3VvTWp0UsHZbhEmTN9kRMlkK7S/LXKi8yQn5yqE4cqo9UPc 0jWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pcpU+FvFksWFtoDfCeEhiR/1YobJbIK1jcc+vk//K04=; b=L7R0CW6SXbTvrSMDbHrsTLBEB2VXyXsXjNHlAnsv0o1GZUPckDwDOd3WBmIcqQ8lUZ awM78kdc5j8VV8OcWcFBW058aq4IKNqoTdeDXCjn7cngTxwNx6rNMIC3CMehqCOarKcj SwfP/c5qGNtDcR2lW1SSFfGqdcbVlePyQq2KfMQ7VtM4om2b89VDXxA2cDjgLSAKelON L7nIBN4fDz/ZVHhrl3fIZ7cSXezBgQYexn3+rFupW7g+oy/Tfokzq6AoOP+I1dqDn8Oh ElQv3r1U9HFrDONNVr4hQOdUIqXXoyKVCRTZEXRVf8aEvDyRcnbMbXVEQilDeaIydQ3F TEuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k15si7965174edk.194.2020.05.04.11.49.51; Mon, 04 May 2020 11:50:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726825AbgEDSil (ORCPT + 99 others); Mon, 4 May 2020 14:38:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:33938 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726519AbgEDSig (ORCPT ); Mon, 4 May 2020 14:38:36 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AAEA0ABCC; Mon, 4 May 2020 18:38:36 +0000 (UTC) Date: Mon, 4 May 2020 20:38:32 +0200 From: Joerg Roedel To: Steven Rostedt Cc: Mathieu Desnoyers , linux-kernel , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Borislav Petkov , Andrew Morton , Shile Zhang , Andy Lutomirski , "Rafael J. Wysocki" , Dave Hansen , Tzvetomir Stoyanov Subject: Re: [PATCH] percpu: Sync vmalloc mappings in pcpu_alloc() and free_percpu() Message-ID: <20200504183832.GL8135@suse.de> References: <20200429082854.6e1796b5@oasis.local.home> <20200429100731.201312a9@gandalf.local.home> <20200430141120.GA8135@suse.de> <20200430121136.6d7aeb22@gandalf.local.home> <20200430191434.GC8135@suse.de> <20200430211308.74a994dc@oasis.local.home> <1902703609.78863.1588300015661.JavaMail.zimbra@efficios.com> <20200430223919.50861011@gandalf.local.home> <20200504151236.GI8135@suse.de> <20200504134042.178409c3@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200504134042.178409c3@gandalf.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 04, 2020 at 01:40:42PM -0400, Steven Rostedt wrote: > Seems that your patch caused a lockdep splat on my box: > > ======================================================== > WARNING: possible irq lock inversion dependency detected > 5.7.0-rc3-test+ #249 Not tainted > -------------------------------------------------------- > swapper/4/0 just changed the state of lock: > ffff9a580fdd75a0 (&ndev->lock){++.-}-{2:2}, at: mld_ifc_timer_expire+0x3c/0x350 > but this lock took another, SOFTIRQ-unsafe lock in the past: > (pgd_lock){+.+.}-{2:2} > > > and interrupts could create inverse lock ordering between them. > > > other info that might help us debug this: > Possible interrupt unsafe locking scenario: > > CPU0 CPU1 > ---- ---- > lock(pgd_lock); > local_irq_disable(); > lock(&ndev->lock); > lock(pgd_lock); > > lock(&ndev->lock); > > *** DEADLOCK *** Fair point, but this just shows how problematic it is to call something like vmalloc_sync_mappings() from a lower-level kernel API function. The obvious fix for this would be to make pgd_lock irq-safe, but this is getting more and more ridiculous. I know you don't like to have a vmalloc_sync_mappings() call in the tracing code, but can you live with it until we get rid of this broken interface? My plan for this is to use a small bitmap to track in the vmalloc and the (x86-)ioremap code at which levels of the page-tables the code made changes and combine that with an architecture-dependend mask to decide whether anything needs to be synced. On x86-64 the sync would be necessary at most 64 times after boot, so I think this will only have a very small performance impact, even with VMAP_STACKS. And as a bonus it would also get rid of vmalloc faulting on x86, fixing the issue with tracing too. Regards, Joerg