From owner-freebsd-current@FreeBSD.ORG Sun Jul 22 00:37:22 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78AC01065670; Sun, 22 Jul 2012 00:37:22 +0000 (UTC) (envelope-from w8hdkim@gmail.com) Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1F7608FC0C; Sun, 22 Jul 2012 00:37:22 +0000 (UTC) Received: by qcsg15 with SMTP id g15so3345953qcs.13 for ; Sat, 21 Jul 2012 17:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=toD30UPiB670h3ODXVr5q/tkTjtNky9p8MRAxj7ymDY=; b=eNXxOn9gLxC9Il+GegPkgC8XLhK+8FJzfliBg/uRQUhqXg+L6+Y408awT2vM0OAKdr LLebzhVNujZ2iFntf2CDrVxrEA8julVwGZSz6427cJZF5dfQTix4HN3/kJj9q5tPvABU qXVrSZ1dX9AO9NtorkjUqQS2WQMgfVveF8GipmzV4L8J04avsZ8utvVf+SHTDPd/g4/9 movMuzGp1WQ12ag6Rp2PVMIu+SrytXl4dcjU1yr6zalziEUxRVFIEeO37uHdcT6Ky06I kW3TfTCOJW0d7xxJgO/STHC4Dz59mz9kkNqRDXHllt0X3O7cec2HP3r/2wCnog+F+PEm U1Rw== MIME-Version: 1.0 Received: by 10.224.59.13 with SMTP id j13mr17403404qah.44.1342917441432; Sat, 21 Jul 2012 17:37:21 -0700 (PDT) Received: by 10.229.39.12 with HTTP; Sat, 21 Jul 2012 17:37:21 -0700 (PDT) In-Reply-To: <20120721211628.GE2676@deviant.kiev.zoral.com.ua> References: <50097BF0.9010103@FreeBSD.org> <20120721211628.GE2676@deviant.kiev.zoral.com.ua> Date: Sat, 21 Jul 2012 20:37:21 -0400 Message-ID: From: Kim Culhan To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-current@freebsd.org, Dimitry Andric Subject: Re: -current build failure X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2012 00:37:22 -0000 On Sat, Jul 21, 2012 at 5:16 PM, Konstantin Belousov wrote: > On Sat, Jul 21, 2012 at 04:00:45PM -0400, Kim Culhan wrote: >> On Fri, Jul 20, 2012 at 11:40 AM, Dimitry Andric wrote: >> > On 2012-07-20 16:49, Kim Culhan wrote: >> >> Seeing this for r:238655 >> > ... >> >> In file included from /usr/src/sys/modules/dtrace/dtrace/../../../sys/pcpu.h:44: >> >> ./machine/pcpu.h:226:13: error: indirection of non-volatile null >> >> pointer will be deleted, not trap >> >> [-Werror,-Wnull-dereference] >> >> : "m" (*(char *)OFFSETOF_CURTHREAD)); >> >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> ./machine/pcpu.h:226:13: note: consider using __builtin_trap() or >> >> qualifying pointer with 'volatile' >> > >> > That's indeed a valid warning from clang, since OFFSETOF_CURTHREAD is >> > usually zero. It's probably due to recent work on dtrace. I'm not in >> > the neighborhood of a FreeBSD box right now to verify, but can you >> > please try to change the cast to "(volatile char *)"? That should fix >> > the warning. >> >> Yes it did, I know there are many considerations wrt to this warning. > > This should be equivalent to what you tried. Can you test build and > boot resulting kernel with this patch ? > > diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h > index 5d1fd4d..7b3c934 100644 > --- a/sys/amd64/include/pcpu.h > +++ b/sys/amd64/include/pcpu.h > @@ -217,16 +217,22 @@ extern struct pcpu *pcpup; > #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) > > #define OFFSETOF_CURTHREAD 0 > +#ifdef __clang__ > +#define VOLATILE volatile > +#else > +#define VOLATILE > +#endif > static __inline __pure2 struct thread * > __curthread(void) > { > struct thread *td; > > __asm("movq %%gs:%1,%0" : "=r" (td) > - : "m" (*(char *)OFFSETOF_CURTHREAD)); > + : "m" (*(VOLATILE char *)OFFSETOF_CURTHREAD)); > return (td); > } > #define curthread (__curthread()) > +#undef VOLATILE > > #define OFFSETOF_CURPCB 32 > static __inline __pure2 struct pcb * The resulting kernel appears to run the same as the kernel tried earlier. Hope this helps. thanks -kim