Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp344894ybt; Wed, 8 Jul 2020 01:09:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQsGUUG7ky2R4XTPgXR2SPQGjGKSmqbgnHRME3u+xXOUH9KeoCM1+5aIOildDqZVcGDrJT X-Received: by 2002:a17:906:b16:: with SMTP id u22mr25763037ejg.53.1594195761539; Wed, 08 Jul 2020 01:09:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594195761; cv=none; d=google.com; s=arc-20160816; b=D+auJNL/74RJAYKFmrGlhaBnL9ZXOvNDZoRTi4iIHVDTQY0hZMebkRYRucLEk855Uf PgMKL2voR3z5dFc4eHtszKVh+7IrLxUzdpx55jJ0qdJNZoT9KveYalaB2qHJ3s+J0f8z GEa+v3Wgl4QwmfQHM1vkH4BnPyI/uMCRHxQMdinoUCIy34c5Nj8jwVADf6IMJQ3DDwdv W+1A3njGR/5bXx/cjsA18b4MPFgo+U8M/8znxS7pxvVdgOGC0uhD3EQkk4ZhqqUGTbnd jIobwPrs0No3u+RAULAFPvcyfxqBmURFPgsfz/QOr9tj6O0KljodXrk7l91BcPUDix9i BCXA== 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=pWgiiBndm2EQro89EXof8h1EQ7q66Q4Z4PcsG2HCzwc=; b=EuU0BfMfLvqduamizaLLKtlRO93LQkiwBJTAYEOHFwphUP3pL+UyNh7rPROZg8wn9p Tcdng4LC6pNtds1+x5JyraiD17URk/76p6VtMb/e1F9JnQhEmf9Drs8njoUL73gxGTYB 7smC6RQWhKPhowHDjzjvr+0RbxPFZALJ1ujeGeve8eyagOZaQZ6FS6fxkPAFOppfi1s+ bGRissyGY4TTtWcLuJ2+1gUA0PzG9JE9+uB36gI9CcShVgI7gpe8CIuJMjiz8fSPznRd 5XZTsKN1FViC3MVVf+SW1h3YIBuFgLJuFawkMnbxOG6kUzYH5QvUaUbM1DrAdUEkDtXx CPxQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si16210704ejn.265.2020.07.08.01.08.59; Wed, 08 Jul 2020 01:09:21 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727914AbgGHHw5 (ORCPT + 99 others); Wed, 8 Jul 2020 03:52:57 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:8233 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726291AbgGHHw5 (ORCPT ); Wed, 8 Jul 2020 03:52:57 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4B1s3n3hS3z9ttw5; Wed, 8 Jul 2020 09:52:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id pMFOMNr9q3WY; Wed, 8 Jul 2020 09:52:53 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4B1s3n2bWGz9ttw4; Wed, 8 Jul 2020 09:52:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B2CE38B7F3; Wed, 8 Jul 2020 09:52:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id FkR4CCf8Gi86; Wed, 8 Jul 2020 09:52:54 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id AD3DF8B76B; Wed, 8 Jul 2020 09:52:53 +0200 (CEST) Subject: Re: [PATCH v3 1/9] powerpc/watchpoint: Fix 512 byte boundary limit To: Jordan Niethe , Ravi Bangoria Cc: Michael Ellerman , mikey@neuling.org, apopple@linux.ibm.com, 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@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20200708045046.135702-1-ravi.bangoria@linux.ibm.com> <20200708045046.135702-2-ravi.bangoria@linux.ibm.com> From: Christophe Leroy Message-ID: <2e418e64-e40a-f33d-8a1f-8f09a4605db9@csgroup.eu> Date: Wed, 8 Jul 2020 09:52:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; 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: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 08/07/2020 à 09:44, Jordan Niethe a écrit : > On Wed, Jul 8, 2020 at 2:53 PM Ravi Bangoria > wrote: >> >> Milton Miller reported that we are aligning start and end address to >> wrong size SZ_512M. It should be SZ_512. Fix that. >> >> While doing this change I also found a case where ALIGN() comparison >> fails. Within a given aligned range, ALIGN() of two addresses does not >> match when start address is pointing to the first byte and end address >> is pointing to any other byte except the first one. But that's not true >> for ALIGN_DOWN(). ALIGN_DOWN() of any two addresses within that range >> will always point to the first byte. So use ALIGN_DOWN() instead of >> ALIGN(). >> >> Fixes: e68ef121c1f4 ("powerpc/watchpoint: Use builtin ALIGN*() macros") >> Reported-by: Milton Miller >> Signed-off-by: Ravi Bangoria >> --- >> arch/powerpc/kernel/hw_breakpoint.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c >> index 0000daf0e1da..031e6defc08e 100644 >> --- a/arch/powerpc/kernel/hw_breakpoint.c >> +++ b/arch/powerpc/kernel/hw_breakpoint.c >> @@ -419,7 +419,7 @@ static int hw_breakpoint_validate_len(struct arch_hw_breakpoint *hw) >> if (dawr_enabled()) { >> max_len = DAWR_MAX_LEN; >> /* DAWR region can't cross 512 bytes boundary */ >> - if (ALIGN(start_addr, SZ_512M) != ALIGN(end_addr - 1, SZ_512M)) >> + if (ALIGN_DOWN(start_addr, SZ_512) != ALIGN_DOWN(end_addr - 1, SZ_512)) > I wonder if you should use end_addr - 1, but rather end_addr. For example: > 512 -> 1023, because of the -1, 1024 will now be included in this > range meaning 513 bytes? end_addr is not part of the range. If you want the range [512;1023], it means addr 512 len 512, that is end_addr = addr + len = 1024 Christophe