Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4288518ybp; Mon, 14 Oct 2019 02:09:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAlvPGGle0YFVzj0n6OMjF5xEoa6cY4vuPSEbHmPHmds2XTqPGn/hk2inJ8jEPgZQmw1cw X-Received: by 2002:a05:6402:703:: with SMTP id w3mr13425447edx.95.1571044185650; Mon, 14 Oct 2019 02:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571044185; cv=none; d=google.com; s=arc-20160816; b=M9J2XRQBkg+ziu/FbZBrpvpWAkYsEwDU4imwMGwSfwSTzZRvhU1wIm8jlZLoaOi8v9 tHgVNdy16cXnPK3SVRFW9sieGcMYcVQnyzbYMddYU2qnmI7AO5qMydRnSeCcav7vTqhy hUDL+fx/Spr/m1CWhFeNV8xDBxiSQEp3Gb3o3ZUIXuGWce1tvC2radFc+lxvF8KDr1Ef m+YmqOwnmu/6baWxwA6C2vUdsgDCD0uR04VdhzBi8ds/E1dHFmO2kbZuFE9r3+fIuxZa DtoFJVInpsYsCOAUEa4hqGqBKkv/vlf882farn7fnP5MlHkPeygX7zJLvygAN6KGfceh B1Jw== 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:dkim-signature; bh=jTDg8IH5LozhrHxBzB1ClkZ0/ElvKEYcyD0vSMTfAMM=; b=isNnMZ9Ucw6cEPgTbp2AYD3bwWO2hiRaHRDhZQaUauT4KdvNMPduaGB99krb6klplL btN3X2LvuZLNWb+SrEjgtVMbOvh8oPyltiuwTS6qANQFteA/Yam2hJEVKHY8w8DKvm6P jDACtY6VTlj+PXBhB7b1oreSFcKn2Hil9wPXOtLG0DjgKJgVODDPt/kMnHEumw6wmzVM 8Kt7Bch/O2RvCLmp+w+vBvNG/4Vp8ZqErsaWuda4ZhK5HP+jFk4H8HsU0yewnLjOaaEM 9FBmKO6KpwOC++AXqxVLQV/YfvXe6noLtlwPTxCtVTQPcQtWCYvvnFyWaQtCAtNr1pSu kF2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=K3XJqY2A; 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 o14si10294007ejc.433.2019.10.14.02.09.22; Mon, 14 Oct 2019 02:09:45 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=K3XJqY2A; 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 S1730711AbfJNJJJ (ORCPT + 99 others); Mon, 14 Oct 2019 05:09:09 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51496 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730641AbfJNJJJ (ORCPT ); Mon, 14 Oct 2019 05:09:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jTDg8IH5LozhrHxBzB1ClkZ0/ElvKEYcyD0vSMTfAMM=; b=K3XJqY2A6oBGRw6kRpPiaOQjd R5BN5Dq6pF/0JhnsPRxtpWWk3SRhuBf4OaTYksweoovT8STtsBNklhSms9feMWz1FVkQj/pAMXWju BFBxigEgsrPcV3AbOol/mBX82m4TUFI0Cdq2J4muN2/ITFjS9BBxo6I+F2gWJvQSr4wXLAUQz6+IK DAu0BA0WxJAamB5i8RVz93Q0htTdlOHNuXfjGndhVuojIdkL8Yuults5HeC/5tPgnxbg3wg+f82PE MBna5j9S75u/caXq+uN16gL3Nc+akwh7V3O9ln9BmPj9CUiVoLWNqahtpFqIzC6klChW0OGJx/m/Y bcECZYdfg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iJwLh-0004AL-PF; Mon, 14 Oct 2019 09:09:05 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 23284305E42; Mon, 14 Oct 2019 11:08:09 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 17665202BC5A3; Mon, 14 Oct 2019 11:09:03 +0200 (CEST) Date: Mon, 14 Oct 2019 11:09:03 +0200 From: Peter Zijlstra To: Alexei Starovoitov Cc: Song Liu , "linux-kernel@vger.kernel.org" , "bpf@vger.kernel.org" , "netdev@vger.kernel.org" , Kernel Team , "stable@vger.kernel.org" , Alexei Starovoitov , Daniel Borkmann Subject: Re: [PATCH bpf-next 2/2] bpf/stackmap: fix A-A deadlock in bpf_get_stack() Message-ID: <20191014090903.GA2328@hirez.programming.kicks-ass.net> References: <20191010061916.198761-1-songliubraving@fb.com> <20191010061916.198761-3-songliubraving@fb.com> <20191010073608.GO2311@hirez.programming.kicks-ass.net> <20191010174618.GT2328@hirez.programming.kicks-ass.net> <4865df4d-7d13-0655-f3b4-5d025aaa1edb@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4865df4d-7d13-0655-f3b4-5d025aaa1edb@fb.com> 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 Thu, Oct 10, 2019 at 06:06:14PM +0000, Alexei Starovoitov wrote: > On 10/10/19 10:46 AM, Peter Zijlstra wrote: > > All of stack_map_get_build_id_offset() is just disguisting games; I did > > tell you guys how to do lockless vma lookups a few years ago -- and yes, > > that is invasive core mm surgery. But this is just disguisting hacks for > > not wanting to do it right. > > you mean speculative page fault stuff? > That was my hope as well and I offered Laurent all the help to land it. > Yet after a year since we've talked the patches are not any closer > to landing. > Any other 'invasive mm surgery' you have in mind? Indeed that series. It had RCU managed VMAs and lockless VMA lookups, which is exactly what you need here. > > Basically the only semi-sane thing to do with that trainwreck is > > s/in_nmi()/true/ and pray. > > > > On top of that I just hate buildids in general. > > Emotions aside... build_id is useful and used in production. > It's used widely because it solves real problems. AFAIU it solves the problem of you not knowing what version of the binary runs where; which I was hoping your cloud infrastructure thing would actually know already. Anyway, I know what it does, I just don't nessecarily agree it is the right way around that particular problem (also, the way I'm personally affected is that perf-record is dead slow by default due to built-id post processing). And it obviously leads to horrible hacks like the code currently under discussion :/ > This dead lock is from real servers and not from some sanitizer wannabe. If you enable CFS bandwidth control and run this function on the trace_hrtimer_start() tracepoint, you should be able to trigger a real AB-BA lockup. > Hence we need to fix it as cleanly as possible and quickly. > s/in_nmi/true/ is certainly an option. That is the best option; because tracepoints / perf-overflow handlers really should not be taking any locks. > I'm worried about overhead of doing irq_work_queue() all the time. > But I'm not familiar with mechanism enough to justify the concerns. > Would it make sense to do s/in_nmi/irgs_disabled/ instead? irqs_disabled() should work in this particular case because rq->lock (and therefore all it's nested locks) are IRQ-safe.