From owner-freebsd-current@freebsd.org Mon Aug 6 08:03:04 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11C051073D50 for ; Mon, 6 Aug 2018 08:03:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A694C8DDC8; Mon, 6 Aug 2018 08:03:03 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 94BC32604A5; Mon, 6 Aug 2018 10:03:01 +0200 (CEST) Subject: Re: panic after ifioctl/if_clone_destroy From: Hans Petter Selasky To: Matthew Macy , Roman Bogorodskiy Cc: freebsd-current@freebsd.org References: <20180805153556.GA1957@kloomba> Message-ID: <8acc8f27-29f2-d4c1-7473-f7053b14e7ad@selasky.org> Date: Mon, 6 Aug 2018 10:02:40 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------49F70DB08EF10129B2DB182D" Content-Language: en-US X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 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: Mon, 06 Aug 2018 08:03:04 -0000 This is a multi-part message in MIME format. --------------49F70DB08EF10129B2DB182D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Roman, Can you try the attached patch? --HPS --------------49F70DB08EF10129B2DB182D Content-Type: text/x-patch; name="epoch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="epoch.diff" Index: sys/kern/subr_epoch.c =================================================================== --- sys/kern/subr_epoch.c (revision 336962) +++ sys/kern/subr_epoch.c (working copy) @@ -232,33 +232,14 @@ struct epoch_thread *tdwait; struct turnstile *ts; struct lock_object *lock; - int spincount, gen; int locksheld __unused; record = __containerof(cr, struct epoch_record, er_record); td = curthread; locksheld = td->td_locks; - spincount = 0; counter_u64_add(block_count, 1); if (record->er_cpuid != curcpu) { /* - * If the head of the list is running, we can wait for it - * to remove itself from the list and thus save us the - * overhead of a migration - */ - if ((tdwait = TAILQ_FIRST(&record->er_tdlist)) != NULL && - TD_IS_RUNNING(tdwait->et_td)) { - gen = record->er_gen; - thread_unlock(td); - do { - cpu_spinwait(); - } while (tdwait == TAILQ_FIRST(&record->er_tdlist) && - gen == record->er_gen && TD_IS_RUNNING(tdwait->et_td) && - spincount++ < MAX_ADAPTIVE_SPIN); - thread_lock(td); - return; - } - /* * Being on the same CPU as that of the record on which * we need to wait allows us access to the thread * list associated with that CPU. We can then examine the --------------49F70DB08EF10129B2DB182D--