Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3445647pxb; Mon, 16 Nov 2020 15:10:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeEOEVIamiXzp0W1XRk5KzeLT12N70YgA5XyV31km1/FFXUrLvoV97tydvTlU8q27BBYCy X-Received: by 2002:aa7:d858:: with SMTP id f24mr17455875eds.12.1605568223531; Mon, 16 Nov 2020 15:10:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605568223; cv=none; d=google.com; s=arc-20160816; b=ULiKvqAPQpW/omM8hwduKeNDiedQRHiQW6WB1e6sz8zYF8sSDIKkLG1sx7ugT+0b2x enCaLaWsOTq+n4GllZgsnZudUG/GLOpUega84WZw6n+u/wfe6XSqsFjmVXPMWwc/B8sS iq2uaIzcfM+EbeT+lPb4p40JefUhPzClHEzE25vWt3D+nf97HuK5/cgjijBdk1T5Efy4 4XBE+vjsqSQz8zcAMcLg2jonnweU/rf7ZTStfU3d8Par6eK6+4JJYeDHiPuPMZTg0FOm yjjdzrZRpUD6o59q3yiS+b+EFn/oLRir9KlqBQVRT/ci0b8/VcH2UwmtfofQRfTk2mJK /15A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=pkMMx2It+5Pvco6e/Mzh+7cjlpElvgRby/hMw4rxyqs=; b=r7iqEZNUhcznzyvKq8nW6zvodYD/cIpoE3Khr+yyHT5Z7rlM2bLFmfFTRjO4iUUHXZ /HK5xqV7a+bmTDHk5FdcmQesqFlJQ114brjja3cBH4gj6sEadRq00pbVLsK8QiWLYMPp UcSLCAtYfUseMpFXIwXW83rdXcfbfVAoXM7u2XlSFYU8HR99orJ/cvn5g5fEhtTo3aA0 b2yRXR2O5dTdMzdAuUB3GKCzp5H5p5Wn+WM3xczSfnufczXmoeF8VVSmStEP7aGui+tn 6EDVfX+j1R2jOJe8J0s3GGp4bOyT3y707ULF/QXECWIQCZJdXaaRg2tAT0CBxRGeiNv0 Wumw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pSihbiP0; 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 a5si5473422ejs.534.2020.11.16.15.10.01; Mon, 16 Nov 2020 15:10:23 -0800 (PST) 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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pSihbiP0; 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 S1727098AbgKPXAJ (ORCPT + 99 others); Mon, 16 Nov 2020 18:00:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgKPXAJ (ORCPT ); Mon, 16 Nov 2020 18:00:09 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7EA4C0613CF; Mon, 16 Nov 2020 15:00:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=pkMMx2It+5Pvco6e/Mzh+7cjlpElvgRby/hMw4rxyqs=; b=pSihbiP0NpEOovk4JegF6/FeWU XH/+UeM50+Ld8mGi/S0oS6QD2oizuU5SikacL1Pr7lbExrkBag7/nF+/j00HNz0L7rxtUpqHYHF+c SPhqS9d3VkJcm46rGTa3XE4AjKMsgiru+TK5a66JhFqK9D7FZqp4bZmwRPw7RfINnnJoIMIRufSlu wkhkUohGrkUvQC2La2lXAiyL0rONWV4fze+BaKcLMUZo9of2cH1IvNQUYuAACJpexkgXD0ccYSWvh 2RZyGqv6K2ZKXZXb3mAKx/+Le4NXuhO3pGuXtcuF+Zgtz88134/+by+UMzUgISNH7ePZSAFfkJ/Eq NY+3sZmQ==; Received: from [2601:1c0:6280:3f0::f32] by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kenTh-0004T5-H3; Mon, 16 Nov 2020 23:00:05 +0000 Subject: Re: [PATCH] md: dm-writeback: add __noreturn to BUG-ging function To: Christian Borntraeger , linux-kernel@vger.kernel.org Cc: Mikulas Patocka , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Heiko Carstens , Vasily Gorbik , linux-s390@vger.kernel.org References: <20201113225228.20563-1-rdunlap@infradead.org> <344abf76-9405-58ba-2dc4-27cab88c974d@de.ibm.com> From: Randy Dunlap Message-ID: Date: Mon, 16 Nov 2020 15:00:01 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <344abf76-9405-58ba-2dc4-27cab88c974d@de.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/15/20 11:30 PM, Christian Borntraeger wrote: > > > On 13.11.20 23:52, Randy Dunlap wrote: >> Building on arch/s390/ flags this as an error, so add the >> __noreturn attribute modifier to prevent the build error. >> >> cc1: some warnings being treated as errors >> ../drivers/md/dm-writecache.c: In function 'persistent_memory_claim': >> ../drivers/md/dm-writecache.c:323:1: error: no return statement in function returning non-void [-Werror=return-type] > > ok with me, but I am asking why > > the unreachable macro is not good enough. For x86 it obviously is. > > form arch/s390/include/asm/bug.h > #define BUG() do { \ > __EMIT_BUG(0); \ > unreachable(); \ > } while (0) > Hi Christian, Good question. I don't see any guidance about when to use one or the other etc. I see __noreturn being used 109 times and unreachable(); being used 33 times, but only now that I look at them. That had nothing to do with why I used __noreturn in the patch. > >> >> Fixes: 48debafe4f2f ("dm: add writecache target") >> Signed-off-by: Randy Dunlap >> Cc: Mikulas Patocka >> Cc: Alasdair Kergon >> Cc: Mike Snitzer >> Cc: dm-devel@redhat.com >> Cc: Heiko Carstens >> Cc: Vasily Gorbik >> Cc: Christian Borntraeger >> Cc: linux-s390@vger.kernel.org >> --- >> drivers/md/dm-writecache.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> --- linux-next-20201113.orig/drivers/md/dm-writecache.c >> +++ linux-next-20201113/drivers/md/dm-writecache.c >> @@ -317,7 +317,7 @@ err1: >> return r; >> } >> #else >> -static int persistent_memory_claim(struct dm_writecache *wc) >> +static int __noreturn persistent_memory_claim(struct dm_writecache *wc) >> { >> BUG(); >> } >> thanks. -- ~Randy