From owner-svn-src-all@freebsd.org Wed Jul 26 15:09:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 936B0DC0041; Wed, 26 Jul 2017 15:09:10 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: from mail-ua0-f178.google.com (mail-ua0-f178.google.com [209.85.217.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5251865EA6; Wed, 26 Jul 2017 15:09:09 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: by mail-ua0-f178.google.com with SMTP id q25so100188698uah.1; Wed, 26 Jul 2017 08:09:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VjF/2004FgQZrqLKJJ7pgWJ7Pko0fKoazVGBiT91YAc=; b=ukCtHEc/s7Mc2Fk7YqEfhUDhBwdcHuoW6PeBjgmrvbubSER5ZjmGikxCPMep0hNtAq J9S/6YpsJEt6669zRH95Cv4N0WaY2ZMh8iPmFM+OgbL0fbDEhDOchamoqex5WwIt3tLw SITRCmmgUBMdexpgb0sgripboPb4XO1V9motMeOiFvd4B1aqc4lKtDsUIVBnAVqWeoec lkU17Cngsd9u9UOJiA+E/OdFb0haGlM9WPjw5qlBEDvtixXyLlFhRYd0J2VdEvB0eTBG 0EqgiZcoXrS8cMku8wMM2O58xdZy/xxGguxzkPlVLaulYfXhSnAgkQzJzpOqye2RIn0M Zd/g== X-Gm-Message-State: AIVw111RiAnHJBG8jVeECzJu/E88rts8sGEc6F3BEPEsxrxG6aMoerPZ rHxOgzZzgpRpDkmvOYIC3g== X-Received: by 10.176.79.155 with SMTP id m27mr730604uah.66.1501081742753; Wed, 26 Jul 2017 08:09:02 -0700 (PDT) Received: from mail-ua0-f182.google.com (mail-ua0-f182.google.com. [209.85.217.182]) by smtp.gmail.com with ESMTPSA id 71sm3763200vkh.56.2017.07.26.08.09.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 08:09:02 -0700 (PDT) Received: by mail-ua0-f182.google.com with SMTP id f9so119219125uaf.4; Wed, 26 Jul 2017 08:09:01 -0700 (PDT) X-Received: by 10.176.79.43 with SMTP id n43mr791361uah.101.1501081741519; Wed, 26 Jul 2017 08:09:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.32.75 with HTTP; Wed, 26 Jul 2017 08:09:00 -0700 (PDT) In-Reply-To: <201705191304.v4JD45Sn021851@repo.freebsd.org> References: <201705191304.v4JD45Sn021851@repo.freebsd.org> From: Michael Zhilin Date: Wed, 26 Jul 2017 18:09:00 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r318539 - head/lib/libthr/thread To: Eric van Gyzen , kib@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Michael Zhilin Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 15:09:10 -0000 Hi Eric, Konstantin, This commit breaks libthread_db a bit, particular change is: -struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; +static struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; In libthread_db there is check if _thread_keytable is found in symbols of debugged process: https://svnweb.freebsd.org/base/head/lib/libthread_db/libthr_db.c?revision=241720&view=markup#l148 LOOKUP_SYM(ph, "_thread_keytable", &ta->thread_keytable_addr); If symbol is not found, pt_ta_new returns "TD_NOLIBTHREAD", even if process uses libthr. It impacts sysutils/pstack port, it doesn't work for multithreaded processes anymore. Eric, Konstantin, Could you please advise what is best way to fix it: - rollback change of "_thread_keytable" (it looks easy) - or remove "_thread_keytable" from libthread_db ? Thanks! On Fri, May 19, 2017 at 4:04 PM, Eric van Gyzen wrote: > Author: vangyzen > Date: Fri May 19 13:04:05 2017 > New Revision: 318539 > URL: https://svnweb.freebsd.org/changeset/base/318539 > > Log: > libthr: fix warnings at WARNS=6 > > Fix warnings about the following when WARNS=6 (which I will commit soon): > > - casting away const > - no previous 'extern' declaration for non-static variable > - others as explained by #pragmas and comments > - unused parameters > > The last is the only functional change. > > Reviewed by: kib > MFC after: 3 days > Sponsored by: Dell EMC > Differential Revision: https://reviews.freebsd.org/D10808 > > Modified: > head/lib/libthr/thread/thr_attr.c > head/lib/libthr/thread/thr_exit.c > head/lib/libthr/thread/thr_sig.c > head/lib/libthr/thread/thr_spec.c > head/lib/libthr/thread/thr_stack.c > head/lib/libthr/thread/thr_symbols.c > head/lib/libthr/thread/thr_umtx.c > head/lib/libthr/thread/thr_umtx.h > > Modified: head/lib/libthr/thread/thr_attr.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_attr.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_attr.c Fri May 19 13:04:05 2017 > (r318539) > @@ -607,7 +607,7 @@ _pthread_attr_setaffinity_np(pthread_att > /* Kernel checks invalid bits, we check it here > too. */ > size_t i; > for (i = kern_size; i < cpusetsize; ++i) { > - if (((char *)cpusetp)[i]) > + if (((const char *)cpusetp)[i]) > return (EINVAL); > } > } > > Modified: head/lib/libthr/thread/thr_exit.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_exit.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_exit.c Fri May 19 13:04:05 2017 > (r318539) > @@ -119,7 +119,8 @@ _Unwind_GetCFA(struct _Unwind_Context *c > #endif /* PIC */ > > static void > -thread_unwind_cleanup(_Unwind_Reason_Code code, struct _Unwind_Exception > *e) > +thread_unwind_cleanup(_Unwind_Reason_Code code __unused, > + struct _Unwind_Exception *e __unused) > { > /* > * Specification said that _Unwind_Resume should not be used here, > @@ -130,10 +131,10 @@ thread_unwind_cleanup(_Unwind_Reason_Cod > } > > static _Unwind_Reason_Code > -thread_unwind_stop(int version, _Unwind_Action actions, > - int64_t exc_class, > - struct _Unwind_Exception *exc_obj, > - struct _Unwind_Context *context, void *stop_parameter) > +thread_unwind_stop(int version __unused, _Unwind_Action actions, > + int64_t exc_class __unused, > + struct _Unwind_Exception *exc_obj __unused, > + struct _Unwind_Context *context, void *stop_parameter __unused) > { > struct pthread *curthread = _get_curthread(); > struct pthread_cleanup *cur; > > Modified: head/lib/libthr/thread/thr_sig.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_sig.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_sig.c Fri May 19 13:04:05 2017 > (r318539) > @@ -441,7 +441,7 @@ _thr_signal_init(int dlopened) > } > > void > -_thr_sigact_unload(struct dl_phdr_info *phdr_info) > +_thr_sigact_unload(struct dl_phdr_info *phdr_info __unused) > { > #if 0 > struct pthread *curthread = _get_curthread(); > > Modified: head/lib/libthr/thread/thr_spec.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_spec.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_spec.c Fri May 19 13:04:05 2017 > (r318539) > @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); > > #include "thr_private.h" > > -struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; > +static struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; > > __weak_reference(_pthread_key_create, pthread_key_create); > __weak_reference(_pthread_key_delete, pthread_key_delete); > > Modified: head/lib/libthr/thread/thr_stack.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_stack.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_stack.c Fri May 19 13:04:05 2017 > (r318539) > @@ -290,6 +290,19 @@ _thr_stack_alloc(struct pthread_attr *at > return (-1); > } > > +/* > + * Disable this warning from clang: > + * > + * cast from 'char *' to > + * 'struct stack *' increases required alignment from 1 to 8 > + * [-Werror,-Wcast-align] > + * spare_stack = (struct stack *) > + */ > +#ifdef __clang__ > +#pragma GCC diagnostic push > +#pragma GCC diagnostic ignored "-Wcast-align" > +#endif > + > /* This function must be called with _thread_list_lock held. */ > void > _thr_stack_free(struct pthread_attr *attr) > @@ -316,3 +329,7 @@ _thr_stack_free(struct pthread_attr *att > attr->stackaddr_attr = NULL; > } > } > + > +#ifdef __clang__ > +#pragma GCC diagnostic pop > +#endif > > Modified: head/lib/libthr/thread/thr_symbols.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_symbols.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_symbols.c Fri May 19 13:04:05 2017 > (r318539) > @@ -37,6 +37,10 @@ __FBSDID("$FreeBSD$"); > > #include "thr_private.h" > > +#ifdef __clang__ > +#pragma GCC diagnostic ignored "-Wmissing-variable-declarations" > +#endif > + > /* A collection of symbols needed by debugger */ > > /* int _libthr_debug */ > > Modified: head/lib/libthr/thread/thr_umtx.c > ============================================================ > ================== > --- head/lib/libthr/thread/thr_umtx.c Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_umtx.c Fri May 19 13:04:05 2017 > (r318539) > @@ -168,7 +168,7 @@ __thr_umutex_timedlock(struct umutex *mt > } > > int > -__thr_umutex_unlock(struct umutex *mtx, uint32_t id) > +__thr_umutex_unlock(struct umutex *mtx) > { > > return (_umtx_op_err(mtx, UMTX_OP_MUTEX_UNLOCK, 0, 0, 0)); > > Modified: head/lib/libthr/thread/thr_umtx.h > ============================================================ > ================== > --- head/lib/libthr/thread/thr_umtx.h Fri May 19 13:02:19 2017 > (r318538) > +++ head/lib/libthr/thread/thr_umtx.h Fri May 19 13:04:05 2017 > (r318539) > @@ -44,7 +44,7 @@ int __thr_umutex_lock(struct umutex *mtx > int __thr_umutex_lock_spin(struct umutex *mtx, uint32_t id) __hidden; > int __thr_umutex_timedlock(struct umutex *mtx, uint32_t id, > const struct timespec *timeout) __hidden; > -int __thr_umutex_unlock(struct umutex *mtx, uint32_t id) __hidden; > +int __thr_umutex_unlock(struct umutex *mtx) __hidden; > int __thr_umutex_trylock(struct umutex *mtx) __hidden; > int __thr_umutex_set_ceiling(struct umutex *mtx, uint32_t ceiling, > uint32_t *oldceiling) __hidden; > @@ -155,7 +155,7 @@ _thr_umutex_unlock2(struct umutex *mtx, > if (atomic_cmpset_rel_32(&mtx->m_owner, id, noncst ? > UMUTEX_RB_NOTRECOV : UMUTEX_UNOWNED)) > return (0); > - return (__thr_umutex_unlock(mtx, id)); > + return (__thr_umutex_unlock(mtx)); > } > > do { > >