From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH 2/2] virtio-rng: fix stuck in catting hwrng attributes Date: Mon, 15 Sep 2014 18:48:46 +0200 Message-ID: <20140915164846.GA29862@potion.brq.redhat.com> References: <1410340027-15373-1-git-send-email-akong@redhat.com> <1410340027-15373-3-git-send-email-akong@redhat.com> <8738byie04.fsf@rustcorp.com.au> <20140913171258.GB12276@zen.redhat.com> <20140914011208.GA1032@zen.redhat.com> <20140914022553.GC1032@zen.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: amit.shah@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org To: Amos Kong Return-path: Content-Disposition: inline In-Reply-To: <20140914022553.GC1032@zen.redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: kvm.vger.kernel.org 2014-09-14 10:25+0800, Amos Kong: > On Sun, Sep 14, 2014 at 09:12:08AM +0800, Amos Kong wrote: > > ... > > > > > diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c > > > > > index c591d7e..b5d1b6f 100644 > > > > > --- a/drivers/char/hw_random/core.c > > > > > +++ b/drivers/char/hw_random/core.c > > > > > @@ -195,8 +195,7 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf, > > > > > > > > > > mutex_unlock(&rng_mutex); > > > > > > > > > > - if (need_resched()) > > > > > - schedule_timeout_interruptible(1); > > > > > + schedule_timeout_interruptible(10); If cond_resched() does not work, it is a bug elsewehere. > Problem only occurred in non-smp guest, we can improve it to: > > if(!is_smp()) > schedule_timeout_interruptible(10); > > is_smp() is only available for arm arch, we need a general one. (It is num_online_cpus() > 1.)