Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp3117942ybg; Sat, 6 Jun 2020 11:13:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiYHuHL1KhIo7Eb7rahazcSx6HofRx6w0Atol2JDo5dmM+T/M+ie1rBaoJ3OW2fEcZcv9Q X-Received: by 2002:a17:906:3a43:: with SMTP id a3mr13730344ejf.121.1591467186584; Sat, 06 Jun 2020 11:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591467186; cv=none; d=google.com; s=arc-20160816; b=wGyC802lGB1W1YxU3Mf8Wj2+NMkaiYXk7yzSCQG6aU0D1nCLCdEmmoo6O7A7kcxkVx Ptoc+qjzsaEDTvCbnoZEwWahcAqAwyG+Ljt4FGHiVVeeYz8zli+Gc51bJoiOX1i0ZwBB OxFQdJ3nnIoc/YNLjrelsLaChlCmapu21avURlesr/5UIA6/hWs/CH3yO81acjE5tCZF sQ2NF093qkrLkN3m0B+SpdB/f9IoJSd35I4DrUiIb62XO3AlYrnjN+yc3J3gZfp0p9h1 gh03AGyyQ3H4xbVVteaYXKWO/OSzVCobnggRpcW5IIXOEIF8kUp+kOHYH/TaTLETGKcV 2nDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=QTH9JLRzy2NwgC+3OyMaPcwMGGjp2Yb3j/auCRMYzHo=; b=hJeifLv39kRCnOL2KxLMYIYgnzgfS/KkzY6EFJVFN7c8yKWErPO5ZUopOYQNzsZ/CX cOgYRTuThA6CUg47Xli5PyLZ5cpqY9Uz+xJ8MdMMzUeS8p12ngF11AIqVyNKgMRW+pPy V2x32MfZVbfwJR/U5ybx6Nd9Ndw0x55PELpDu+FEk4AOpZv9d7x60GvW7uKn+eg31G0H +b2dEfL8vnHWmd/LEFoKZbhWiNGNF2II4M8TQcCAvQJ2fjJHkZK3Mtz37RiWT7pkr4yG 3/cGWtdxDy8R0hln5qGwwQxo+ZBT/nf/lKf0Hc8Emwtzi5CLsJIp+hAN7tJoc0V1YPyt Q4aA== 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 v1si6111060ejd.588.2020.06.06.11.12.43; Sat, 06 Jun 2020 11:13:06 -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 S1728864AbgFFSKF (ORCPT + 99 others); Sat, 6 Jun 2020 14:10:05 -0400 Received: from gate.crashing.org ([63.228.1.57]:38522 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728788AbgFFSKE (ORCPT ); Sat, 6 Jun 2020 14:10:04 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 056I9CBj006803; Sat, 6 Jun 2020 13:09:12 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 056I9AdG006802; Sat, 6 Jun 2020 13:09:10 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sat, 6 Jun 2020 13:09:10 -0500 From: Segher Boessenkool To: Vaibhav Jain Cc: Ira Weiny , Santosh Sivaraj , linux-nvdimm@lists.01.org, "Aneesh Kumar K . V" , linux-kernel@vger.kernel.org, Steven Rostedt , "Oliver O'Halloran" , Dan Williams , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v10 6/6] powerpc/papr_scm: Implement support for PAPR_PDSM_HEALTH Message-ID: <20200606180910.GW31009@gate.crashing.org> References: <20200604234136.253703-1-vaibhav@linux.ibm.com> <20200604234136.253703-7-vaibhav@linux.ibm.com> <20200605183655.GP1505637@iweiny-DESK2.sc.intel.com> <87wo4kfk58.fsf@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wo4kfk58.fsf@linux.ibm.com> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 06, 2020 at 06:04:11PM +0530, Vaibhav Jain wrote: > >> + /* update health struct with various flags derived from health bitmap */ > >> + health = (struct nd_papr_pdsm_health) { > >> + .dimm_unarmed = p->health_bitmap & PAPR_PMEM_UNARMED_MASK, > >> + .dimm_bad_shutdown = p->health_bitmap & PAPR_PMEM_BAD_SHUTDOWN_MASK, > >> + .dimm_bad_restore = p->health_bitmap & PAPR_PMEM_BAD_RESTORE_MASK, > >> + .dimm_encrypted = p->health_bitmap & PAPR_PMEM_ENCRYPTED, > >> + .dimm_locked = p->health_bitmap & PAPR_PMEM_SCRUBBED_AND_LOCKED, > >> + .dimm_scrubbed = p->health_bitmap & PAPR_PMEM_SCRUBBED_AND_LOCKED, > > > > Are you sure these work? These are not assignments to a bool so I don't think > > gcc will do what you want here. > Yeah, somehow this slipped by and didnt show up in my tests. I checked > the assembly dump and seems GCC was silently skipping initializing these > fields without making any noise. It's not "skipping" that, it initialises the field to 0, just like your code said it should :-) If you think GCC should warn for this, please open a PR? It is *normal* for bit-fields to be truncated from what is assigned to it, but maybe we could warn for it in the 1-bit case (we currently don't seem to, even when the bit-field type is _Bool). Thanks, Segher