Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp534194ybh; Tue, 21 Jul 2020 01:17:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyioxNqnbOIzs3vH4eTSG/PpT91P41g7Kzw39jBZnez5ZaofW3o/O5GWOznbFgaadVC/coc X-Received: by 2002:a50:ee8a:: with SMTP id f10mr24359779edr.383.1595319465086; Tue, 21 Jul 2020 01:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595319465; cv=none; d=google.com; s=arc-20160816; b=Jr5uJfon27iNnXB5PEuo4e4eEFhaRQFBfjVrkAWmnr8WJc0GVslFSC8T412PXHTIjn Omue+3Xm15u4AhSOQi9rU69GqsUVvLRO/sU3AIzyY6rhq7bqUm4OVfpqwxr+CsprFPfn ere1iY/AxTDheVqRmGPUQ7OHO7mp3A/2FvGPCHTBEkvxG1OgA+Z9vc5qFTHiys3Wyvec vbohJulqvpqsbhsGTWraI45gYQDS2O9ykw/PC0KPvs3DsipURoBFHcNFunQEy3IfI+3U WUwu5FCnshtP/+cSM3WRxE2fBGciDKrmaHC5wyE20QQ35XtyvNb1AqxaNnJ8upVKcCwM 4Iyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=AnBZjOmYkEdtl5FczbndA4vJ3Jtr5YjvyKjknijQ9vk=; b=CZyuCCvRwVU8IHBMoiOi+E8iTZ1g1DfIfKDvNHwAVaAUWkG2VuhFrUEA7nDevZmY+Y KLl+34fvoPei+XWnuL1GTkMbGAiQW19Bn2I40RhezIfVjFvG2r3Ji+j5NRx1WdaRia/x JqxLgeRj2cdiOam966K+YmKey/O2x4AsdEWvDdiWwBT4T/0TIilzR+phzrulNu8m3IJ7 nmhJzf7qiiMZW9ZcB7EiW+kENUpzSbXVI3nrjWAm4BRTMQOUCDMlU/4Oxet7CbUe53EW mnl4OH4r9VXhDOS5RUeSA/Aa4BcFQ1hmS5V/8L/5FdyLX4XcI92O+iSLyo5ZibmneXK6 mvpg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mm15si11236461ejb.561.2020.07.21.01.17.22; Tue, 21 Jul 2020 01:17:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726933AbgGUIQc (ORCPT + 99 others); Tue, 21 Jul 2020 04:16:32 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49332 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725984AbgGUIQc (ORCPT ); Tue, 21 Jul 2020 04:16:32 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06L82PW7010886; Tue, 21 Jul 2020 04:16:08 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32d5k0qtw0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jul 2020 04:16:08 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06L851h7021841; Tue, 21 Jul 2020 04:16:08 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 32d5k0qtuv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jul 2020 04:16:07 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06L8G68f014775; Tue, 21 Jul 2020 08:16:06 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 32brq81u9s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jul 2020 08:16:05 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06L8G2VP27918632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jul 2020 08:16:03 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC96D4C050; Tue, 21 Jul 2020 08:16:02 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7AEEE4C04A; Tue, 21 Jul 2020 08:15:59 +0000 (GMT) Received: from [9.199.47.202] (unknown [9.199.47.202]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 21 Jul 2020 08:15:59 +0000 (GMT) Subject: Re: [PATCH v4 09/10] powerpc/watchpoint: Return available watchpoints dynamically To: Jordan Niethe Cc: Michael Ellerman , mikey@neuling.org, Paul Mackerras , Nicholas Piggin , Christophe Leroy , naveen.n.rao@linux.vnet.ibm.com, peterz@infradead.org, jolsa@kernel.org, oleg@redhat.com, fweisbec@gmail.com, mingo@kernel.org, pedromfc@br.ibm.com, miltonm@us.ibm.com, linuxppc-dev , linux-kernel@vger.kernel.org, Ravi Bangoria References: <20200717040958.70561-1-ravi.bangoria@linux.ibm.com> <20200717040958.70561-10-ravi.bangoria@linux.ibm.com> From: Ravi Bangoria Message-ID: Date: Tue, 21 Jul 2020 13:45:58 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-21_02:2020-07-21,2020-07-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 impostorscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007210052 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>> @@ -46,7 +47,7 @@ struct arch_hw_breakpoint { >>>> >>>> static inline int nr_wp_slots(void) >>>> { >>>> - return HBP_NUM_MAX; >>>> + return cpu_has_feature(CPU_FTR_DAWR1) ? HBP_NUM_TWO : HBP_NUM_ONE; >>> So it'd be something like: >>> + return cpu_has_feature(CPU_FTR_DAWR1) ? HBP_NUM_MAX : 1; >>> But thinking that there might be more slots added in the future, it >>> may be better to make the number of slots a variable that is set >>> during the init and then have this function return that. >> >> Not sure I follow. What do you mean by setting number of slots a >> variable that is set during the init? > Sorry I was unclear there. > I was just looking and saw arm also has a variable number of hw breakpoints. > If we did something like how they handle it, it might look something like: > > static int num_wp_slots __ro_after_init; > > int nr_wp_slots(void) { > return num_wp_slots; > } > > static int __init arch_hw_breakpoint_init(void) { > num_wp_slots = work out how many wp_slots > } > arch_initcall(arch_hw_breakpoint_init); > > Then we wouldn't have to calculate everytime nr_wp_slots() is called. > In the future if more wp's are added nr_wp_slots() will get more complicated. > But just an idea, feel free to ignore. Ok I got the idea. But ARM arch_hw_breakpoint_init() is much more complex compared to our nr_wp_slots(). I don't see any benefit by making our code like ARM. Thanks for the idea though :) Ravi