Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3990493pxb; Tue, 17 Nov 2020 08:36:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/V0N5xZICg19kX/5AYJtCnSD7i73HofFhjexpWX74iE6TkB9q0MsvR55Xqn1T7y10+m8N X-Received: by 2002:a17:906:8145:: with SMTP id z5mr19118896ejw.461.1605630999436; Tue, 17 Nov 2020 08:36:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605630999; cv=none; d=google.com; s=arc-20160816; b=EvlMXQuVeDEnJ0A3+aEEYs0Ol7zO/6EK8P1qY2OWyNinRNuedRvKRWjKXN1/+CYHy0 5m/tCXeS3RyLAHjyTxSqcVt6fKXhM8OXAcayfcyACSgIh7qm9UCHm0Xztl4tgb9OPeeN BVIXUz5htYU4LGpmNzXSGCEQS7YBHDcQb1IfFSxGxLxUHfdukRi79/u/KWVNi2OfPlPe FLVx1gfojjEEtVztNfCf+LTeBWHo3RQ5NWn+NRuiu9ApygVuTReNXiUAfqJvc6hLOlHg wS5HETZClDQ08qiwBkOHwTepGVMwlTygo7XTansHGbApcV7DcdYwbvKJsDyRsFKK21T8 p5nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=lxDt74PLhWGBodZNX7JaAIeh6BN7s3VRDIqoAirYccw=; b=vEb+L6pcU3ZRHYsTagaDy1k3ggK1LtjFiYxKzCYyBoxHYzAKOgPlH+kisrd5berfQ7 UVTXmJjuhGbgVDMu0t1Jj/mWQTb+9ukhjkIxJYeqAhDBlwzJ4Bdi6JurkOK7ZbVLDbTn /2EF+rMGZwhf2IlDMrqZsRBSY/+rUcJFM7uWRodz1+UerKpfBUb8bdb3Lz7Hz88k6XVB PRJ9Qe1GzNSxvRB05UT8h7qt+WNlIhVS7eu0v5gaMF6AiTAvpaSHpNTy9iI9aGX3K9+G aYUtxhYwm0k0S/WfSr8rUIXxrdTs+ZrHlW0TlSg7NId9/RrPq/0I2Q7SDUwgy++JIZuc b4hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="QeyhHA4/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si1174422edn.43.2020.11.17.08.36.12; Tue, 17 Nov 2020 08:36:39 -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=@redhat.com header.s=mimecast20190719 header.b="QeyhHA4/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728286AbgKQQb7 (ORCPT + 99 others); Tue, 17 Nov 2020 11:31:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41559 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727147AbgKQQb7 (ORCPT ); Tue, 17 Nov 2020 11:31:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605630718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lxDt74PLhWGBodZNX7JaAIeh6BN7s3VRDIqoAirYccw=; b=QeyhHA4/H3COXzWR0Dya3Vw30KFg9EWGBgPH5VkAV7nTGbbGot9rKhmpjoBdnMnM4+0Rfn UZsLwN4LVtMkpV3xJavZPNrijchK2YlIsKf7ynlxJ9l15RUIqRhwWTE42EyePx6e2ECw6P 4hh82Icx5Q9z1MRu7JqTiYixbLrRX4g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-RcfOoVoSMN6ynhrMIpuCvg-1; Tue, 17 Nov 2020 11:31:54 -0500 X-MC-Unique: RcfOoVoSMN6ynhrMIpuCvg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A75F71868427; Tue, 17 Nov 2020 16:31:51 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AA145D9E8; Tue, 17 Nov 2020 16:31:48 +0000 (UTC) Date: Tue, 17 Nov 2020 11:31:47 -0500 From: Mike Snitzer To: Randy Dunlap Cc: Christian Borntraeger , linux-kernel@vger.kernel.org, Mikulas Patocka , Alasdair Kergon , dm-devel@redhat.com, Heiko Carstens , Vasily Gorbik , linux-s390@vger.kernel.org Subject: Re: md: dm-writeback: add __noreturn to BUG-ging function Message-ID: <20201117163147.GA27243@redhat.com> References: <20201113225228.20563-1-rdunlap@infradead.org> <344abf76-9405-58ba-2dc4-27cab88c974d@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 16 2020 at 6:00pm -0500, Randy Dunlap wrote: > 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. But doesn't that speak to the proper fix being needed in unreachable()? Or at a minimum the fix is needed to arch/s390/include/asm/bug.h's BUG. I really don't think we should be papering over that by sprinkling __noreturn around the kernel's BUG() callers. Maybe switch arch/s390/include/asm/bug.h's BUG to be like arch/mips/include/asm/bug.h? It itself uses __noreturn with a 'static inline' function definition rather than #define. Does that fix the issue? Thanks, Mike p.s. you modified dm-writecache.c (not dm-writeback, wich doesn't exist).