From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756652AbcIFPGH (ORCPT ); Tue, 6 Sep 2016 11:06:07 -0400 Received: from merlin.infradead.org ([205.233.59.134]:37736 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755954AbcIFPGF (ORCPT ); Tue, 6 Sep 2016 11:06:05 -0400 Date: Tue, 6 Sep 2016 17:05:47 +0200 From: Peter Zijlstra To: Alan Stern Cc: Felipe Balbi , "Paul E. McKenney" , Ingo Molnar , USB list , Kernel development list , Will Deacon Subject: Re: Memory barrier needed with wake_up_process()? Message-ID: <20160906150547.GG2794@worktop> References: <20160906122037.GL10168@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 06, 2016 at 10:46:55AM -0400, Alan Stern wrote: Not knowing where INFO() goes, you should use trace_printk() not printk(), as the former is strictly per cpu, while the latter is globally serialized and can hide all these problems. > Index: usb-4.x/drivers/usb/gadget/function/f_mass_storage.c > =================================================================== > --- usb-4.x.orig/drivers/usb/gadget/function/f_mass_storage.c > +++ usb-4.x/drivers/usb/gadget/function/f_mass_storage.c > @@ -485,6 +485,8 @@ static void bulk_out_complete(struct usb > spin_lock(&common->lock); > bh->outreq_busy = 0; > bh->state = BUF_STATE_FULL; > + if (bh->bulk_out_intended_length == US_BULK_CB_WRAP_LEN) > + INFO(common, "compl: bh %p state %d\n", bh, bh->state); > wakeup_thread(common); > spin_unlock(&common->lock); > } > @@ -2207,6 +2209,7 @@ static int get_next_command(struct fsg_c > rc = sleep_thread(common, true); > if (rc) > return rc; > + INFO(common, "next: bh %p state %d\n", bh, bh->state); > } > smp_rmb(); > rc = fsg_is_set(common) ? received_cbw(common->fsg, bh) : -EIO; >