Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp119378imu; Thu, 8 Nov 2018 05:59:55 -0800 (PST) X-Google-Smtp-Source: AJdET5cuVN1X9FbCksssRkNdB09T4sBgp4MKfKvbPg1I0dlBC98VjtWcia7QZkPKqB3v7KBVpvwK X-Received: by 2002:a63:f547:: with SMTP id e7mr3955678pgk.182.1541685594870; Thu, 08 Nov 2018 05:59:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541685594; cv=none; d=google.com; s=arc-20160816; b=ntFHY1phdhjT1IxST9uE3WE6j4dVjLnJw9wNY1rq5cntyzw9R8fcKGodzRaggDRF7O B/sUvo/OEK0D3XJyiKHN7Za4u5+QD0j9Qs4ppBg7IY97QS91LgZHwzWfd7oTq+/+SWge fPwEJNPyIKqWzF7uzJ7c/v4oMJMCSizoBN7dxvZX8RZWvlPCOixphuQ6tG52bR8cS5Kf BIqnF8YBSofnF8nt/R0+XrPJmLkZIu6iYZFMg5rPB7wnvVocBduT9g6M9ORBfDhBNb1M l8iOg4E5dbkIHdXa9iGwDs/Fd/XrxugpqIxxWwRPY6PMgmV2Wq90fBqDGwNymruEwHGR YjhQ== 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=HEbdqYE9zkR4dfr2fg3xE2ZDioBzmagWmjY0LRTGCNI=; b=EHSL+YkVzJDExwr05Lf+S4aTIBGdSKmWvr2Rs23pM1agBrHixKJ3rmtdOcaibTKzof /GoyASdTOZNqSYCLDZnCm6wH2hPgug9hb3vnPbmZOXq3NEqFU+aM2gfYu0UwvbuHI7pX 5joFmU5wxLaLyxPm3fPNfKyVKngXwkPvViEynDJneZNOmcM33Zv3P3VhMKiMCqDLwa1G yAFsVwrj91h6nZHn88hQVBqG4Z8s8/hZM7FITp6BZ6QGwSJE++3EGY3xkMqiIxtXov8J 4luN7V58Y6ighs7kjaK0mmPGCM5am2tiUIf4xJ5h01e5yzHgxzX8dXD8PvmL5OgJBxfS UA6Q== ARC-Authentication-Results: i=1; mx.google.com; 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 e1-v6si4460889plk.4.2018.11.08.05.59.39; Thu, 08 Nov 2018 05:59:54 -0800 (PST) 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; 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 S1727027AbeKHXew (ORCPT + 99 others); Thu, 8 Nov 2018 18:34:52 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:35866 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726719AbeKHXev (ORCPT ); Thu, 8 Nov 2018 18:34:51 -0500 Received: by mail-qk1-f196.google.com with SMTP id o125so26557422qkf.3 for ; Thu, 08 Nov 2018 05:59:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HEbdqYE9zkR4dfr2fg3xE2ZDioBzmagWmjY0LRTGCNI=; b=hAD5fclDMy4+jqL9Zma6tXCUrF2WjR31N6ZUivfh9+dmxokmUggJHAnV4ZZbl75qds 1ZS700BQWwryH0aQUw5hIoCl2UX8Efz3FibvhLXn2lBZM5iFTjH6T86ToqZVgjcvW0CO qWGwJlqvCqHFz3X/xGTV/j99qEfBzi3kV/Ynmz9fZg35zLY+IQUA3UW0KzGBj0lXz28A WlqefU69h/pP+rXUA2IMHcuMkmYWj17qn3Jqkons6vDRGezAcgar3er+YkQQspTfgFKK LmZg8+enhep+gtOSfWqh2KdMYhcEXdPipPJFGv/QPSwovPKELQTbMYSKdilDjLThDT3f 8nIA== X-Gm-Message-State: AGRZ1gI9U5gBJyZ25SAg4+v0ZaM9OdL2LQHrnNGmC/oG3R/4hRVjmlRi OYjbUaGjzBiIIOI574et9vo= X-Received: by 2002:ac8:b0e:: with SMTP id e14mr4467119qti.336.1541685554456; Thu, 08 Nov 2018 05:59:14 -0800 (PST) Received: from [9.18.239.97] ([32.104.18.243]) by smtp.gmail.com with ESMTPSA id z8-v6sm1962298qto.71.2018.11.08.05.59.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 05:59:13 -0800 (PST) Subject: Re: [PATCH] powerpc: Mark variable `cpumsr` as unused To: Mathieu Malaterre , Christophe LEROY Cc: Michael Ellerman , Paul Mackerras , linuxppc-dev , LKML , Michael Neuling References: <20181107202641.7865-1-malat@debian.org> From: Breno Leitao Message-ID: <1b62012a-1c59-ef62-117f-ec04fa47a815@debian.org> Date: Thu, 8 Nov 2018 11:59:11 -0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, Christophe Thanks for spotting and fixing this bug. On 11/08/2018 05:25 AM, Mathieu Malaterre wrote: > On Thu, Nov 8, 2018 at 7:09 AM Christophe Leroy wrote: >> >> >> >> On 11/07/2018 08:26 PM, Mathieu Malaterre wrote: >>> Add gcc attribute unused for `cpumsr` variable. >>> >>> Fix warnings treated as errors with W=1: >>> >>> arch/powerpc/kernel/process.c:231:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] >>> arch/powerpc/kernel/process.c:296:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] >>> >>> Signed-off-by: Mathieu Malaterre >> >> I don't think this is the good way to fix that. This problem was >> introduced by commit 5c784c8414fb ("powerpc/tm: Remove >> msr_tm_active()"). That commit should be reverted and fixed. > > I see, it makes sense. > >> That commit should have removed the macro and kept the inline function. > > Breno, what do you think ? Turning this macro into a function might cause the code to be more confused, since all the other TM states bits are checked using a macro, for example: MSR_TM_SUSPENDED Checks if the MSR has Suspended bits set MSR_TM_TRANSACTIONAL Checks if the MSR has the transactional bits set MSR_TM_RESV Checks if the MSR has the TM reserved bits set That said, I understand that it makes sense to have an uniform way to check for TM bits in MSR, thus having a MSR_TM_ACTIVE macro to check for the active bits. Using a non-uniform function just to fix this warning seems to be an overkill. Reverting the patch seems to bring back the old style, which is having a macro and a function with the same name, where the function just calls the macro. Anyway, I think it might have other ways to fix warning, as I can think now: 1) Avoid setting cpumsr if CONFIG_PPC_TRANSACTIONAL_MEM is not enabled 2) If !CONFIG_PPC_TRANSACTIONAL_MEM, redefine MSR_TM_ACTIVE(x) to something as (x & 0) instead of 0. 3) Avoid double definition of MSR_TM_ACTIVE, i.e, have the same definition independent of PPC_TRANSACTIONAL_MEM being set or not. Anyway, I would like to try option 3), which is the hardest one to implement and validate, but it seems to be the most correct option, once it checks for a MSR bit configuration, and the caller should have the logic.