Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp142819ybz; Thu, 23 Apr 2020 20:26:35 -0700 (PDT) X-Google-Smtp-Source: APiQypINd0L4GJest/XTgv5TLU5dr3ectebNK7K9kd62HwUX7OGW/tYwPDEe86vh6enbxwHUok95 X-Received: by 2002:a17:906:46da:: with SMTP id k26mr5549492ejs.106.1587698795647; Thu, 23 Apr 2020 20:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587698795; cv=none; d=google.com; s=arc-20160816; b=jBiM1leeKAQ/stq7g5fkc0y977rfTQwd8pgUpIVNjBogdBahfoHiXzJw+yW7yYw+t2 CeMQW0fvENeuEH/O/E9ngXydguXY8HpZG2ovgyeHmJy0ZSM/T1RgQztb43V2DPJcf1X+ kQE+8+0VlV0zUAguPXOE/tfq3mwrxEfVw9x62vFMPNjq81CIIQdXEe8JnOjh/7N7JrwW 33rVx/q6rZBvLeEsbWDQexSBYAdg0W2rVMbS4jNKOWVND/j+60MJO5EVCM94b4SXx3LC 9COo7ohsYJUI0laWomktPAYZ8SlDdbRjznKmV29JU9SmlXKV66Y5qA9+mlvOykgwp8NM DcWw== 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=QI5VCyudnuMY2CpoC7DldcTfYGGU5XtL6q9AXjXoXpc=; b=lE0j7IcXOLI0xTwoGvF8Ihq5cXcsVAx9rPtYKuE9H/6Hp8FfhTR9/d84m+60EQSGJQ 8uEFp9Csam3LI6SSnk7eV21giOW25EMUogFwVrKghb+fH+gB/zq8RdDpNLYi7jTu3jnF m4pOHH4tALZoVtpN8wvWyk6ukwkHYT2HEqWEvHSzz92S7j+h6+HiL5+ihCvM2O3KNdc3 n4NjY8hzc2LuCOgtHSTOLATnK7rWxMk74TU4KT6meGAuDIdD1GdVNtTniINbM8XKrl0P B1mN39BP2QZL3jC0NzuKf+K/4Hiws7Roa2vx1BOe6UhfSwxEP98eBouRFP3/hFWqTEoN pZ+g== 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 f4si2642840ejd.83.2020.04.23.20.26.12; Thu, 23 Apr 2020 20:26:35 -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 S1726380AbgDXDYx (ORCPT + 99 others); Thu, 23 Apr 2020 23:24:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:20862 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725884AbgDXDYx (ORCPT ); Thu, 23 Apr 2020 23:24:53 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03O31xQG041126; Thu, 23 Apr 2020 23:24:24 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 30jrc6g40m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Apr 2020 23:24:24 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 03O33UZR044734; Thu, 23 Apr 2020 23:24:24 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 30jrc6g3yv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Apr 2020 23:24:23 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03O3A8cj023768; Fri, 24 Apr 2020 03:24:21 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma01fra.de.ibm.com with ESMTP id 30fs658fte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Apr 2020 03:24:21 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03O3OI2s66781476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Apr 2020 03:24:18 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C80A52052; Fri, 24 Apr 2020 03:24:18 +0000 (GMT) Received: from [9.199.51.89] (unknown [9.199.51.89]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3931F5204E; Fri, 24 Apr 2020 03:24:15 +0000 (GMT) Subject: Re: [PATCH v3 12/16] powerpc/watchpoint: Use builtin ALIGN*() macros To: Christophe Leroy Cc: mpe@ellerman.id.au, mikey@neuling.org, apopple@linux.ibm.com, paulus@samba.org, npiggin@gmail.com, naveen.n.rao@linux.vnet.ibm.com, peterz@infradead.org, jolsa@kernel.org, oleg@redhat.com, fweisbec@gmail.com, mingo@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ravi Bangoria References: <20200414031659.58875-1-ravi.bangoria@linux.ibm.com> <20200414031659.58875-13-ravi.bangoria@linux.ibm.com> From: Ravi Bangoria Message-ID: <2892a62b-eec3-802d-df52-960f3f1e246d@linux.ibm.com> Date: Fri, 24 Apr 2020 08:54:14 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-23_19:2020-04-23,2020-04-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004240015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christophe, >>           max_len = DAWR_MAX_LEN; >>           /* DAWR region can't cross 512 bytes boundary */ >> -        if ((start_addr >> 9) != (end_addr >> 9)) >> +        if ((start_addr >> 9) != ((end_addr - 1) >> 9)) > > What about: >     if (ALIGN(start_addr, SZ_512M) != ALIGN(end - 1, SZ_512M)) ok. > >>               return -EINVAL; >>       } else if (IS_ENABLED(CONFIG_PPC_8xx)) { >>           /* 8xx can setup a range without limitation */ >> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c >> index aab82ab80dfa..06679adac447 100644 >> --- a/arch/powerpc/kernel/process.c >> +++ b/arch/powerpc/kernel/process.c >> @@ -800,12 +800,12 @@ static inline int set_breakpoint_8xx(struct arch_hw_breakpoint *brk) >>       unsigned long lctrl1 = LCTRL1_CTE_GT | LCTRL1_CTF_LT | LCTRL1_CRWE_RW | >>                      LCTRL1_CRWF_RW; >>       unsigned long lctrl2 = LCTRL2_LW0EN | LCTRL2_LW0LADC | LCTRL2_SLW0EN; >> -    unsigned long start_addr = brk->address & ~HW_BREAKPOINT_ALIGN; >> -    unsigned long end_addr = (brk->address + brk->len - 1) | HW_BREAKPOINT_ALIGN; >> +    unsigned long start_addr = ALIGN_DOWN(brk->address, HW_BREAKPOINT_SIZE); >> +    unsigned long end_addr = ALIGN(brk->address + brk->len, HW_BREAKPOINT_SIZE); >>       if (start_addr == 0) >>           lctrl2 |= LCTRL2_LW0LA_F; >> -    else if (end_addr == ~0U) >> +    else if (end_addr - 1 == ~0U) > > What about: >     else if (end_addr == 0) That's better. Thanks, Ravi