Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp70426imm; Thu, 30 Aug 2018 16:05:47 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb14k6+fRzP7GSilO7nm2o5tfbMw+F3G1YgOn4SLT+cXWuR9+sOUbJ+fjqoOLJrOvATXAxg X-Received: by 2002:a17:902:5a3:: with SMTP id f32-v6mr12506038plf.286.1535670347590; Thu, 30 Aug 2018 16:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535670347; cv=none; d=google.com; s=arc-20160816; b=oGc5pLovSkXA4B+sEbd1C6QMA1mFzpDKHB6CwfvrWEksba6u/zIymNTekvZVmFsxDA 6r0zrqAEtioCAjfv1/BUsmBZvRGBGZiQxfwBNJiEIzBeRhjBZK49aWrP3J/atgErTh93 IEplTj+TvpyNSie/aYPuEQ+nHhYD5UZkBqYROcbo1JDyOnBKArNOxKE70LryP0Tqy+iT uGLmpQmXs/3TP37tzGLl7l8BJ7+7TArQ9FCWDLcv84oHNiHYCJezW7NrZR6YbNCbz+iT RYqiss10qikspClqkBKK77ak720eVvuWTX3zas3uHjMYOrEbv8aoB/SQ5nLGAEuY3NjN fydQ== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=6xrneNq/HkvlMjgb348sXaXH7GDpZyZ8B7HqHjo0ppk=; b=gtkIra31Jx5yfWkt21J9zEGkoA49d3V/fC26hjdR0lp9MISzRKF63LTF/bKPN/iXak c4F9tlU9GASeBjxyCfFPg4OssBUxEbGNxrvgFFGcWDOr/xn2yr0wXO3TDZu5+U+YXegC 9pxQ6YV8DbdcLadu+ylU1+bzXx/7NTEQ29ot7iKGcAS+RIpIUu+Vnzj9/yq23hgknT79 J2kzY7kyvPp4dwEhKx0jx+N0bPLB+sWlyk1gdOAYM/tUVYdcWeBB+lQ58ilCpc7tFs0v VS2Mb6+vsz7SOOjhuJK3HYom4vYU4aTM74accLAlBiJXe4Jwq1Aa+/ubKoyq01oTyJEj XYrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=NHX4AcEx; 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; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b128-v6si8172993pfb.352.2018.08.30.16.05.32; Thu, 30 Aug 2018 16:05:47 -0700 (PDT) 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; dkim=pass header.i=@arista.com header.s=googlenew header.b=NHX4AcEx; 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; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727238AbeHaDIz (ORCPT + 99 others); Thu, 30 Aug 2018 23:08:55 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:34259 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbeHaDIz (ORCPT ); Thu, 30 Aug 2018 23:08:55 -0400 Received: by mail-ed1-f68.google.com with SMTP id u1-v6so7552183eds.1 for ; Thu, 30 Aug 2018 16:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=6xrneNq/HkvlMjgb348sXaXH7GDpZyZ8B7HqHjo0ppk=; b=NHX4AcExtl7BwQZC3UuRclRqoP31cT4zWBs64F3xh7/jb2ZoBt4uJXB7oGFz13ope+ u1ZW5FNyVS0GMJgqxqYDklHxJleh1doUDN3CAQVeXzuhysjM/I0B96NsVBfUk0268IVo ieIUMnXZ3W4kPFc6JeAF0iXemiJlRPQ8Xsra87o6W8etz27VdHbrAwGUAUKPNPX1CuTf bgWq1MRycU085qfydTe7V9gVDjkYYIrDWs2iPpiqQqdIcnYL9oQJjtBFhk49yG3ZB47N 6Uwt2zT0kLgSHZMd0x3wMdllgqAP9xhmU56BIsgNWiNd9QpPNN1LmsrHNQRao2WESGXT Ns8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=6xrneNq/HkvlMjgb348sXaXH7GDpZyZ8B7HqHjo0ppk=; b=hU9lOa85shFgkZEkSGTyPhwkCKJlfj4c2C+awYMhJwhwc1vbSXgcAD4bfWtc6bz1XP M5opH4/Bj4z8rN4xhsJOYxoeXLaIpEmrevb1jBP6Z7LOO/0H6Fwct5/aeJZYXyOH7zXb 4XNsOQgYlPP7x6MtFoH3bPsMKt2paGwdSZoUn0XStW60SHsqpmdqZ+vUTZlfAgKKgl5U Xe92zuhYGdcmxaWhiisXB0MBKDjFAyIKxzLLd2YKVu8lCjrrDLfGdzMXufKmcp9BbBDK JRgMWUSC9nWMLFO8UydLvil23hTCJVF40LRBYa5ABzMXc22O/TdtX9lBWQgqjfFMqRlL koAg== X-Gm-Message-State: APzg51BrjmC4Y84hFkElbXRHsTWX6Rv63ASV5qGzWCReNS58CWVNXNaF XTvkgaagz4PHwpeLvMEaQe8+rLdl8NA= X-Received: by 2002:a50:f002:: with SMTP id r2-v6mr14821945edl.91.1535670263978; Thu, 30 Aug 2018 16:04:23 -0700 (PDT) Received: from dhcp.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id w41-v6sm3591211edd.92.2018.08.30.16.04.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Aug 2018 16:04:23 -0700 (PDT) Message-ID: <1535670261.23560.77.camel@arista.com> Subject: Re: [PATCH 05/23] selftest: vm: add unlikely() to BUG_ON() From: Dmitry Safonov To: Igor Stoppa , linux-kernel@vger.kernel.org Cc: Igor Stoppa , Shuah Khan Date: Fri, 31 Aug 2018 00:04:21 +0100 In-Reply-To: <1535669872.23560.73.camel@arista.com> References: <20180830223429.30051-1-igor.stoppa@huawei.com> <20180830223429.30051-6-igor.stoppa@huawei.com> <1535669872.23560.73.camel@arista.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.6 (3.24.6-1.fc26) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-08-30 at 23:57 +0100, Dmitry Safonov wrote: > Hi Igor, > > On Fri, 2018-08-31 at 01:34 +0300, Igor Stoppa wrote: > > BUG_ON() is unlikely() to BUG() > > This selftest runs in userspace.. > So, we should define the macro somehow, as i.e: > rseq/rseq.h:#define rseq_unlikely(x) __builtin_expect(!!(x), 0) > > Otherwise, > [selftests]$ make vm/map_populate > cc vm/map_populate.c -o vm/map_populate > vm/map_populate.c: In function ‘parent_f’: > vm/map_populate.c:26:7: warning: implicit declaration of function > ‘unlikely’; did you mean ‘unlinkat’? [-Wimplicit-function- > declaration] > if (unlikely(condition)) { \ > ^ > vm/map_populate.c:38:2: note: in expansion of macro ‘BUG_ON’ > BUG_ON(ret <= 0, "read(sock)"); > ^~~~~~ > /tmp/cc7evGVG.o: In function `parent_f': > map_populate.c:(.text+0x3d): undefined reference to `unlikely' > map_populate.c:(.text+0xbb): undefined reference to `unlikely' > map_populate.c:(.text+0x135): undefined reference to `unlikely' > map_populate.c:(.text+0x1b0): undefined reference to `unlikely' > > Not sure if we care for this at all for userspace test. > I don't mind as it runs each time by kbuild robot and cumulatively > may > save something. But it's better be at least compile-tested. JFI, there are a plenty of definitions for unlikely(): [linux]$ git grep 'define unlikely' tools +rseq_unlikely() from tools/testing/selftests/rseq/rseq.h Probably, the one from "tools/include/linux/compiler.h" can be used in tools directory. -- Dima