From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753003AbcFPHWZ (ORCPT ); Thu, 16 Jun 2016 03:22:25 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47277 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752269AbcFPHWX (ORCPT ); Thu, 16 Jun 2016 03:22:23 -0400 X-IBM-Helo: d28dlp02.in.ibm.com X-IBM-MailFrom: maddy@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Subject: Re: [PATCH] tools/perf: fix the word selected in find_*_bit To: George Spelvin , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <20160615124409.6985.qmail@ns.sciencehorizons.net> Cc: acme@kernel.org, adrian.hunter@intel.com, bp@suse.de, dsahern@gmail.com, jolsa@redhat.com, linux@horizon.com, linux@rasmusvillemoes.dk, mpe@ellerman.id.au, namhyung@kernel.org, wangnan0@huawei.com, yury.norov@gmail.com From: Madhavan Srinivasan Date: Thu, 16 Jun 2016 12:51:44 +0530 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160615124409.6985.qmail@ns.sciencehorizons.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16061607-0052-0000-0000-0000027B1488 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16061607-0053-0000-0000-00000CE37E61 Message-Id: <479a4811-9aa2-57fd-a1a5-900bacdd69fc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-16_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606160085 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 15 June 2016 06:14 PM, George Spelvin wrote: > Madhavan Srinivasan wrote: >> +#if (__BYTE_ORDER == __BIG_ENDIAN) && (BITS_PER_LONG != 64) >> + tmp = addr[(((nbits - 1)/BITS_PER_LONG) - (start / BITS_PER_LONG))] >> + ^ invert; >> +#else >> tmp = addr[start / BITS_PER_LONG] ^ invert; >> +#endif > Than you for diagnosing this problem, but I don't think the fix > is correct. > > 1) It's not clear that all users of _find_next_bit and for_each_set_bit() > want this change. > 2) Is your code even correct? I'd think you'd want addr[x ^ 1]. Are you > sure you shpuld be reversing the whole array, and not just the halves of > each 64-bit word? > 3) You've now broken the case of 32-bit big-endian kernel. Yes. But looks like we havent hit this case yet. Will post a fix. Maddy > > I think the proper solution is uglier than this. :-( >