Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1511129imm; Tue, 15 May 2018 22:00:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpjTMmKYhDh/SG9o0dxQp9SHJcO860L2BdyE6b6BIojha4HRtv5IIcXVBkrZXy+/AmjMTVg X-Received: by 2002:a65:4c4f:: with SMTP id l15-v6mr14711154pgr.61.1526446802889; Tue, 15 May 2018 22:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526446802; cv=none; d=google.com; s=arc-20160816; b=ZRck7xSOQfVWcNB/AhNkKOOPMZjwhExPn++Y1fWKvbv7wL7enTLVe6UR1xJR082gpG Dmd0BBBK7s95VeMGbpUYMlYe/Tb98URboxM57YNXhx3oZhUC77+siMYT7+l+R2cZF7us Y+wgg4JsdvOOVC+Nmx9eHyIkna6CP+xpykVEyQgVWx0r5b+uf2eEzEJ9V9IX6qll/h2o 5IPplSxAyFCVoHtPv4wCeAk113SkOrTvv2wqWQxzAviwEt37/V5AZwfFKNuM5d51cmuN Kp+lPo+/zFzg0WJ+Ee7BO4SiWzfSeEcRcRFYGCgVCvI6V60c02vE5f+z+q7ou7qvaX7A AaOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=191aBFmemFRiUB+HtD8cmDEXYTtYt15bS962Hi6x2bI=; b=EoT/2ZehLhjDwzO6Qw2+Fr1MyFJ1MogU6Ah8PVciz7CZaZF+Ld2rZ2tGMl9gXCvsAa 0b3gHC7ru7fFCS2JuL5kjewA6Sw7v8Z6EIivnt/RFbKFet3AG5bTOet/fkIDkZ3WtSFM 9x+/ddTwZKbOOSTDKmZpRCEu1Lxua+67uhR5Em/qo94ayR+IB9B01nER2qLQmIQtpbsP Jb02Q9ruxH7TF00Egvp5cpa/qGAm6dnAGA3Zm5/g+tDkIIwN/NWshYpC0LIjkZ+GU65z kgeE2BFYdcEpRSudnFty50iNYtwgxUBOSdLyz7aTdpmg0V6mCx3u8ZJ3c5nSJcr/09qk sWfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=bSZF2Goz; 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 u10-v6si1721433pfh.145.2018.05.15.21.59.48; Tue, 15 May 2018 22:00:02 -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=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=bSZF2Goz; 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 S1752047AbeEPE6I (ORCPT + 99 others); Wed, 16 May 2018 00:58:08 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35264 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751332AbeEPE6G (ORCPT ); Wed, 16 May 2018 00:58:06 -0400 Received: by mail-pg0-f67.google.com with SMTP id n1-v6so1039960pgs.2 for ; Tue, 15 May 2018 21:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=191aBFmemFRiUB+HtD8cmDEXYTtYt15bS962Hi6x2bI=; b=bSZF2Goz1PJ022rJ2fkuWQEnjorL9AxIJFam9sRPUohKLw1dQ8M8qnwbF5F1x6m6y2 543pRCS/Cw42dU33JMZ4nnPElyBiU+UZnsXgmpV42eIQgg7hlITmZLb7YlTIpEkF05of am1QR4CMt07qvj5BdaOdMiYBkaUaMCb3PYU7UIWLGi23IDCyG29E9I6KohumuVJkx8MB 5NyxKCAw0gNTOESuidJvuiBbCDm4FvkHlIerta4lJaGva21oOH32M1TOvKj0bX0YaCxG vZEIA+hnb8LdL1AXarTxYJdvUsDcH1+YPHYo7HCstBSudDXgcGze2k4H0dw6jfVrGdd1 EChA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=191aBFmemFRiUB+HtD8cmDEXYTtYt15bS962Hi6x2bI=; b=hoUf4DZjrtUObxNy+yA7Awk0ScYr5CQ8IYW/Ncnzh2BDGWReujJfLbkfEuAPXXeRou W7/m/ScLcnBdiD2OwqtnQvt9nkM/9QTPwsRVPpDs0WEix2bFr1YUI/o69uT2R0u9/pHm 1iIWay4SClF+H4hJbep3ysWz86oH2b9FMbtovLpqUt5nJ1tFTp5U744igYUg+LjwAtYq 3siFw6K1qoo1qAfR378F29gSDS7raUuwisC8ElPDXV5XR/KlYm6EIo8K8PWvQBQYNGrt PAiXaLF/ZpaaRYnJDc+ESP1tWu0LpChfwBdgi4CRZ7ftIGe5i8FdnZC17+DTYekrwipi jcVw== X-Gm-Message-State: ALKqPwfSY5GwPJNfYFVhtfw9E8qPkaVTbFZeWMg3f1sgu2ReBp8/BL+m LkiCf9EkDUbjAqSfIijCY7AyKQ== X-Received: by 2002:a65:640e:: with SMTP id a14-v6mr15060056pgv.406.1526446686087; Tue, 15 May 2018 21:58:06 -0700 (PDT) Received: from ?IPv6:2601:646:c200:7429:b1cc:bff6:f471:970b? ([2601:646:c200:7429:b1cc:bff6:f471:970b]) by smtp.gmail.com with ESMTPSA id l14-v6sm1719348pgu.1.2018.05.15.21.58.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 21:58:04 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 8/9] perf/breakpoint: Split breakpoint "check" and "commit" From: Andy Lutomirski X-Mailer: iPhone Mail (15E302) In-Reply-To: <20180516031059.GA2271@lerouge> Date: Tue, 15 May 2018 21:58:03 -0700 Cc: Peter Zijlstra , LKML , Jiri Olsa , Namhyung Kim , Linus Torvalds , Yoshinori Sato , Benjamin Herrenschmidt , Catalin Marinas , Chris Zankel , Paul Mackerras , Thomas Gleixner , Will Deacon , Michael Ellerman , Rich Felker , Ingo Molnar , Mark Rutland , Alexander Shishkin , Andy Lutomirski , Arnaldo Carvalho de Melo , Max Filippov Content-Transfer-Encoding: quoted-printable Message-Id: <99DA1A94-6AF6-4B9A-858A-7018D58CC38E@amacapital.net> References: <1525634395-23380-1-git-send-email-frederic@kernel.org> <1525634395-23380-9-git-send-email-frederic@kernel.org> <20180509091703.GH12217@hirez.programming.kicks-ass.net> <20180516031059.GA2271@lerouge> To: Frederic Weisbecker Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 15, 2018, at 8:11 PM, Frederic Weisbecker wro= te: >=20 >> On Wed, May 09, 2018 at 11:17:03AM +0200, Peter Zijlstra wrote: >>> On Sun, May 06, 2018 at 09:19:54PM +0200, Frederic Weisbecker wrote: >>> arch/arm/include/asm/hw_breakpoint.h | 5 ++++- >>> arch/arm/kernel/hw_breakpoint.c | 22 +++------------------- >>> arch/arm64/include/asm/hw_breakpoint.h | 5 ++++- >>> arch/arm64/kernel/hw_breakpoint.c | 22 +++------------------- >>> arch/powerpc/include/asm/hw_breakpoint.h | 5 ++++- >>> arch/powerpc/kernel/hw_breakpoint.c | 22 +++------------------- >>> arch/sh/include/asm/hw_breakpoint.h | 5 ++++- >>> arch/sh/kernel/hw_breakpoint.c | 22 +++------------------- >>> arch/x86/include/asm/hw_breakpoint.h | 5 ++++- >>> arch/x86/kernel/hw_breakpoint.c | 23 +++-------------------- >>> arch/xtensa/include/asm/hw_breakpoint.h | 5 ++++- >>> arch/xtensa/kernel/hw_breakpoint.c | 22 +++------------------- >>=20 >> Because of those ^, >>=20 >>> kernel/events/hw_breakpoint.c | 11 ++++++----- >>=20 >> would it not make sense to have a prelimenary patch doing something >> like: >>=20 >> __weak int hw_breakpoint_arch_check(struct perf_event *bp) >> { >> return arch_validate_hwbkpt_settings(bp); >> } >=20 > So eventually I fear I can't do that, due to linking order. >=20 > Say I convert x86 to implement hw_breakpoint_arch_check(), so I > remove arch_validate_hwbkpt_settings(). On build time, the weak version > is still compiled and can't find a declaration for arch_validate_hwbkpt_se= ttings(). >=20 > I tried to keep the declaration while the definition has been removed but > it seems the weak version is linked first before it gets later replaced by= > the overriden arch version. So I get a build error. >=20 > I could keep arch_validate_hwbkpt_settings() around on all archs and remov= e it in > the end with the weak version but that would defeat the purpose of removin= g > the mid-state in the current patch. How about just not using weak functions? Weak functions have annoying issue= s like this, and they have trouble generating good code. I much prefer the p= attern: in arch header: extern void arch_func(whatever); #define arch_func arch_func in generic header: #ifndef arch_func static inline void arch_func(whatever) ... #endif=