From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753112AbcFJTg6 (ORCPT ); Fri, 10 Jun 2016 15:36:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54915 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbcFJTg4 (ORCPT ); Fri, 10 Jun 2016 15:36:56 -0400 Date: Fri, 10 Jun 2016 21:36:52 +0200 From: Oleg Nesterov To: Andrea Parri Cc: Peter Zijlstra , LKML Subject: Re: [PATCH] events/uprobes: move smp_read_barrier_depends() where needed Message-ID: <20160610193652.GA14622@redhat.com> References: <1465496321-10898-1-git-send-email-parri.andrea@gmail.com> <20160610070310.GA6843@redhat.com> <20160610122537.GA7776@redhat.com> <20160610130733.GB8203@redhat.com> <20160610143959.GA13453@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 10 Jun 2016 19:36:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/10, Andrea Parri wrote: > > On Fri, Jun 10, 2016 at 4:39 PM, Oleg Nesterov wrote: > > > On 06/10, Oleg Nesterov wrote: > > > > > > On 06/10, Andrea Parri wrote: > > > > > > > > More simply/clean, as you said, maybe; one advantage of keeping > > > > the "raw" smp_read_barrier_depends() in get_trampoline_vaddr() is > > > > that we can avoid it when area is NULL; > > > > > > Do you really think it makes sense to optimize out read_barrier_depends > > here? > > > > > > It can only be NULL in handle_swbp(), and in this case we are going to > > do a > > > lot of work, and in particular install this xol vma, > > > > Not to mention that alpha doesn't support uprobes, so this all is currently > > cosmetic. > > > > Do you mean a "cosmetic" improvement over the current version? ;-) Yes, if you mean "turn smp_read_barrier_depends into lockless_dereference" ;) So I will be happy to ack this patch if you make it. But "optimize out smp_read_barrier_depends if NULL" imho makes no sense. And, speaking of get_trampoline_vaddr() in particular, it is a bit ugly anyway. prepare_uretprobe() can not hit area == NULL and doesn't need a barrier, while handle_swbp() actually wants is_trampoline(bp_vaddr). Not that I really think this needs a cleanup, at least until we change this code to use multiple trampolines (say, for different stacks). Oleg.