All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: Improve MMC performance on Versatile Express
From: Linus Walleij @ 2011-02-01 14:29 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20110121222930.GF23151@n2100.arm.linux.org.uk>

2011/1/21 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Fri, Jan 21, 2011 at 05:20:57PM -0500, Nicolas Pitre wrote:
>> The only solution in that case is to give top priority to the FIFO IRQ
>> and never disable IRQs when in interrupt context, except for that FIFO
>> servicing handler which should keep IRQs masked out throughout. ?In any
>> case this would certainly be only a hack for badly misdesigned hardware.
>
> Not possible anymore. ?The kernel's IRQ handling has changed such that
> generic code now ensures that IRQs are disabled irrespective of the
> IRQF_DISABLED flag. ?All IRQ handlers are called with IRQs disabled,
> and they remain that way until they call local_irq_enable().

Then the only way of assuring low latency on this one IRQ would
be to convert the IRQ handlers for all the *other* hardware in the
Vexpress to request_threaded_irq(), and that's what the RealTime
folks do all the time I believe.

[Pawel Moll]
> (...) so far the only time when problem happens is the timeout caused
> by ISP1761 handler.

Have you considered switching the ISP1761 handler to
request_threaded_irq() with IRQF_ONESHOT | IRQF_NO_SUSPEND
so it runs in process context with that IRQ masked off, until completion?

Linus Walleij

^ permalink raw reply

* [PATCH] arm: Improve MMC performance on Versatile Express
From: Russell King - ARM Linux @ 2011-02-01 14:28 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1296567299.2768.40.camel@hornet.cambridge.arm.com>

On Tue, Feb 01, 2011 at 01:34:59PM +0000, Pawel Moll wrote:
> > And to prove the point, I have MMCI running at up to 4Mbps, an 8 fold
> > increase over what the current fixed upper-rate implementation does.
> > The adaptive rate implementation is just a proof of concept at the
> > moment and requires further work to improve the rate selection algorithm.
> 
> Great, I've terribly glad you managed to have a go at this (I honestly
> wanted to, but simply had no time). I'm looking forward to see the
> patches and will be more than happy to backport them for the sake of the
> Linaro guys using 2.6.35 and 2.6.37 right now.
> 
> On our side we did extend the FIFO and performed some tests (not very
> extensive yet though). The change seems not to break anything and help
> in the pathological (heavy USB traffic) scenario.
> 
> When I get your changes and some official FPGA release, I'll try to push
> the bandwidth limits even further - hopefully changes will complement.

You can't push it any further without increasing the CPU/bus clock rates.
My measurements show that it takes the CPU in the region of 6-9us to
unload 32 bytes from the FIFO, which gives a theoretical limit of 2.8
to 4.2Mbps, depending on how the platform booted (some reboots its
consistently in the order of 6us, some boots its consistently around 9us.)

> > The real solution to this is for there to be proper working DMA support
> > implemented on ARM platforms,
> 
> In case of VE this is all about getting an engine into the test chips,
> what didn't happen for A9 (the request lines are routed between the
> motherboard and the tile and IO FPGA can - theoretically - use the MMCI
> requests). As far as I'm told this cell is simply huge (silicon-wise)
> and therefore it's the first candidate to cut down when area is
> scarce... Anyway, I've spoken to guys around and asked them to keep the
> problem in mind, so we may get something with the next releases.

Bear in mind that PL18x + PL08x doesn't work.  Catalin forwarded my
concerns over this to ARM Support - where I basically ask how to program
the hardware up to DMA a single 64K transfer off a MMC card into a set
of scattered memory locations.

I've yet to have a response, so I'll take it that it's just possible
(the TRMs say as much).

The problem is that for a transfer, the MMCI produces BREQ * n + LBREQ,
and the DMAC will only listen for a LBREQ if it's in peripheral flow
control.  If it's in peripheral flow control, then it ignores the transfer
length field in the control register, only moving to the next LLI when it
sees LBREQ or LSREQ.

It ignores LBREQ and LSREQ in DMAC flow control mode..  You can DMA almost
all the data too/from the MMCI, but you miss the last half-fifo-size worth
of data.  While you can unload that manually for a read, you can't load
it manually for a write.

With peripheral flow control, you can only DMA the requested data to a
single contiguous buffer without breaking the MMC request into much
smaller chunks.  As Peter Pearse's PL08x code seems to suggest, the
maximum size of those chunks is 1K.

This seems to be a fundamental problem with the way each primecell has
been designed.

So, I do hope that someone decides to implement something more reasonable
if Versatile Express were to get a DMA controller.  If it's another PL08x
then it isn't worth it - it won't work.

^ permalink raw reply

* Re: [GIT PULL 0/5] perf/core improvements
From: Arnaldo Carvalho de Melo @ 2011-02-01 14:28 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Frederic Weisbecker, Mike Galbraith, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian, Tom Zanussi
In-Reply-To: <20110201091447.GA27297@elte.hu>

Em Tue, Feb 01, 2011 at 10:14:47AM +0100, Ingo Molnar escreveu:
> 
> * Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> 
> > Hi Ingo,
> > 
> >         Please consider pulling from:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/core
> > 
> 
> Pulled, thanks Arnaldo!
> 
> Note, there's a beauty wart i noticed, while building perf on 32-bit Fedora: the build output
> includes new, unintended lines:
> 
>     CC util/scripting-engines/trace-event-perl.o
>     CC scripts/perl/Perf-Trace-Util/Context.o
>     CC util/scripting-engines/trace-event-python.o
>     CC scripts/python/Perf-Trace-Util/Context.o
>     CC perf.o
>     CC builtin-help.o
> gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iutil/include -I/usr/include/python2.6 -c util/evlist.c -o temp.linux-i686-2.6/util/evlist.o -fno-strict-aliasing -Wno-write-strings
> gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iutil/include -I/usr/include/python2.6 -c util/evsel.c -o temp.linux-i686-2.6/util/evsel.o -fno-strict-aliasing -Wno-write-strings

Yeah, I noticed that too, its on my todo list, its the setup.py python
building part, I need to either make it silent and provide just one:

PYTHON perf.so

message or to ditch using setup.py and do everything directly, which I
may need to do anyway because 'python setup.py --build-base" (or
equivalent, that I haven't found) doesn't work with 'install', just with
'build'.

For now its just a nuisance, not something crucial, but I'll get that
nailed.

- Arnaldo

^ permalink raw reply

* Re: [Qemu-devel] [PATCH 0/2] virtagent - fsfreeze support
From: Jes Sorensen @ 2011-02-01 14:28 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: agl, qemu-devel, mdroth
In-Reply-To: <AANLkTikz+UNp3VU4JhRfUu28X76pG383vC5FzY9dK51o@mail.gmail.com>

On 02/01/11 15:16, Stefan Hajnoczi wrote:
> On Tue, Feb 1, 2011 at 10:58 AM,  <Jes.Sorensen@redhat.com> wrote:
>> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>> This is a first attempt to add fsfreeze support to virtagent. The idea
>> is for the guest agent to walk the list of locally mounted file
>> systems in the guest, and issuing an ioctl to freeze them. The host
>> can then do a live snapshot of the guest, obtaining stable file
>> systems. After the snapshot, the host then calls the thaw function in
>> virtagent, which goes through the list of previously frozen file
>> systems and unfreezes them.
> 
> Any plans for a call-out to pre/post freeze and thaw scripts so that
> applications can flush cached data to disk and brace themselves for
> freeze?

Michael and I were discussing this earlier, we need to add it somehow.
It could be done as call-outs from the freeze call, or from separate
agent calls.

Cheers,
Jes

^ permalink raw reply

* Re: [memory sharing] bug on get_page_and_type
From: Tim Deegan @ 2011-02-01 14:28 UTC (permalink / raw)
  To: George Dunlap; +Cc: MaoXiaoyun, xen devel, juihaochiang@gmail.com
In-Reply-To: <AANLkTim4O6QXdAJedB1KhECpDhrq2w8FTDXn7irQtk2Y@mail.gmail.com>

At 12:47 +0000 on 31 Jan (1296478031), George Dunlap wrote:
> At first glance, it does look like a race, of the type that would
> normally be done by grabbing the p2m lock.  I'd have to take a closer
> look to be sure, but I won't be able to for at least another day or
> two.  Maybe Tim can comment.

Yes, this is a race; it would be fixed by getting rid of the shr_lock
and using the p2m lock to cover page-sahring operations, which I think
is a good idea anyway.  

I think I'll have time to look at the locking properly some time this
month.  Of course, I've been wrong before. :)

Tim.

> 2011/1/31 MaoXiaoyun <tinnycloud@hotmail.com>:
> > Hi Georage:
> >
> >       Thanks for your help, I think I really need to learn hg a bit.
> >       Well, when looking into memory sharing code, a confusion
> > really brother me a lot.
> >       I think maybe you can  enlighten me.
> >
> >       There has been *check action code* do like below steps
> >       1) Use gfn_to_mfn to get p2m_type_t p2mt
> >       2) check the type of p2mt,
> >       3) do some stuffes base if check on step 2 is failed
> >
> >       While when *nominate  page*  to be shared, it does these follow steps
> >       a) check page whether can be shared
> >       b) call page_make_sharable to make sharable
> >       c) if 2) is success, call p2m_change_type to update page type
> > p2m_ram_shared
> >
> >       My confusion is if *nominate page* code reach step b, and before it go
> > to step c
> >        *check action code*  reach its step2, it will find page type is
> > not  p2m_ram_shared
> >        and go to step3. And later "nominate page"  code go to step (c)
> >
> > Take xen/common/memory.c  for example,
> > line 179 is much like step 2, it will goto 196 to clear the _PGC_allocated
> > flag
> > if check failed, so it might indicates, *nominate page* code change the page
> > type
> > into p2m_ram_shared, but the page actually has alreay been freed.
> >
> > Am I right?
> >
> >
> > 155 int guest_remove_page(struct domain *d, unsigned long gmfn)
> > 156 {
> > 157     struct page_info *page;
> > 158 #ifdef CONFIG_X86
> > 159     p2m_type_t p2mt;
> > 160 #endif
> > 161     unsigned long mfn;
> > 162
> > 163 #ifdef CONFIG_X86
> > 164     mfn = mfn_x(gfn_to_mfn(d, gmfn, &p2mt));
> > 165 #else
> > 166     mfn = gmfn_to_mfn(d, gmfn);
> > 167 #endif
> > 168     if ( unlikely(!mfn_valid(mfn)) )
> > 169     {
> > 170         gdprintk(XENLOG_INFO, "Domain %u page number %lx invalid\n",
> > 171                 d->domain_id, gmfn);
> > 172         return 0;
> > 173     }
> > 174
> > 175&nbsp ;    page = mfn_to_page(mfn);
> > 176 #ifdef CONFIG_X86
> > 177     /* If gmfn is shared, just drop the guest reference (which may or
> > may not
> > 178      * free the page) */
> > 179     if(p2m_is_shared(p2mt))
> > 180     {
> > 181         put_page_and_type(page);
> > 182         guest_physmap_remove_page(d, gmfn, mfn, 0);
> > 183         return 1;
> > 184     }
> > 185
> > 186 #endif /* CONFIG_X86 */
> > 187     if ( unlikely(!get_page(page, d)) )
> > 188     {
> > 189         gdprintk(XENLOG_INFO, "Bad page free for domain %u\n",
> > d->domain_id);
> > 190         return 0;
> > 189         gdprintk(XENLOG_INFO, "Bad page free for domain %u\n",
> > d->domain_id);
> > 190         return 0;
> > 191     }
> > 192
> > 193     if ( test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) )
> > 194         put_page_and_type(page);
> > 195
> > 196     if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
> > 197          put_page(page);
> > 198
> > 199     guest_physmap_remove_page(d, gmfn, mfn, 0);
> > 200
> > 201     put_page(page);
> > 202
> > 203     return 1;
> > 204 }
> >
> >> Date: Mon, 31 Jan 2011 10:49:37 +0000
> >> Subject: Re: [Xen-devel] [memory sharing] bug on get_page_and_type
> >> From: George.Dunlap@eu.citrix.com
> >> To: tinnycloud@hotmail.com
> >> CC: xen-devel@lists.xensource.com; tim.deegan@citrix.com;
> >> juihaochiang@gmail.com
> >>
> >> Xiaoyun,
> >>
> >> Thanks for all of your work getting page sharing working. When
> >> submitting patches, please break them down into individual chunks,
> >> each of which does one thing. Each patch should also include a
> >> comment saying what the patch does and why, and a Signed-off-by line
> >> indicating that you certify that the copyright holder (possibly you)
> >> is placing the code under the GPL.
> >>
> >> Using mercurial queues:
> >> http://mercurial.selenic.com/wiki/MqExtension
> >> and the mercurial patchbomb extension:
> >> http://mercurial.selenic.com/wiki/PatchbombExtension
> >> are particularly handy for this process.
> > &g t;
> >> Quick comment: The ept-locking part of the patch is going to be
> >> NACK-ed, as it will cause circular locking dependencies with the
> >> hap_lock. c/s 22526:7a5ee380 has an explanation of the circular
> >> dependency, and a fix which doesn't introduce a circular dependency.
> >> (It may need to be adapted a bit to apply to 4.0-testing)
> >>
> >> -George
> >>
> >> On Mon, Jan 31, 2011 at 10:13 AM, tinnycloud <tinnycloud@hotmail.com>
> >> wrote:
> >> > Hi:
> >> >
> >> >
> >> > Attached is the whole patch suit for latest xen-4.0-testing,changeset
> >> > 21443,
> >> >
> >> > It comes from George, Tim and JuiHao, also, has some extra debug info.
> >> >
> >> >
> >> >
> >> > On most occasion, memory sharing works fine, but still exists a bug.
> >> >
> >> >        I?ve been tracing this problem for a while.
> >> >
> >> >   &nbs p;    There is a bug on get_page_and_type() in
> >> > mem_sharing_share_pages()
> >> >
> >> >
> >> >
> >> >
> >> > --------------------------------------------mem_sharing_share_pages()-----------------------
> >> >
> >> > 789         if(!get_page_and_type(spage, dom_cow, PGT_shared_page)){
> >> >
> >> > 790             mem_sharing_debug_gfn(cd, gfn->gfn);
> >> >
> >> > 791             mem_sharing_debug_gfn(sd, sgfn->gfn);
> >> >
> >> > 792             printk("c->dying %d s->dying %d spage %p se->mfn %lx\n",
> >> > cd->is_dying, sd->is_dying, spage, se->mfn);
> >> >
> >> > 793             printk("Debug page: MFN=%lx is ci=%lx, ti=%lx,
> >> > owner_id=%d\n",
> >> >
> >> > 794                     mfn_x(page_to_mfn(spage)),
> >> >
> >> > 795                     spage->count_info,
> >> >
> >> >  796                     spage->u.inuse.type_info,
> >> >
> >> > 797                     page_get_owner(spage)->domain_id);
> >> >
> >> > 798             BUG();
> >> >
> >> > 799         }
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > Below painc log contains the debug info from line 790-798.
> >> >
> >> > We saw that 180000000000000 which is PGC_state_free,
> >> >
> >> > So it looks like a shared page has been freed unexpectly.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > (XEN) teardown 64
> >> >
> >> > (XEN) teardown 66
> >> >
> >> > blktap_sysfs_destroy
> >> >
> >> > blktap_sysfs_create: adding attributes for dev ffff880109d0c200
> >> >
> >> > blktap_sysfs_destroy
> >> >
> >> > __ratelimit: 1 callbacks suppressed
> >> >
> >> > blktap_sysfs_destroy
> >> >
> >> > (XEN) Debug for domain=83, gfn=1e8dc, Debug page: MFN=1306dc is
> >> > ci=8000000000000005, ti=8400000000000001, owner_id=32755
> >> >
> >> > (XEN) Debug for domain=79, gfn=1dc95, Invalid MFN=ffffffffffffffff
> >> >
> >> > (XEN) c->dying 0 s->dying 0 spage ffff82f60a0f12a0 se->mfn 507895
> >> >
> >> > (XEN) Debug page: MFN=507895 is ci= 180000000000000,
> >> > ti=8400000000000001,
> >> > owner_id=32755
> >> >
> >> > (XEN) Xen BUG at mem_sharing.c:798
> >> >
> >> > (XEN) ----[ Xen-4.0.2-rc2-pre  x86_64  debug=n  Not tainted ]----
> >> >
> >> > (XEN) CPU:    0
> >> >
> >> > (XEN) RIP:    e008:[<ffff82c4801c3760>]
> >> > mem_sharing_share_pages+0x5b0/0x5d0
> >> >
> >> > (XEN) RFLAGS: 0000000000010286   CONTEXT: hypervisor
> >> >
> >> > (XEN) rax: 0000000000000000   rbx: ffff83044ef76000   rcx:
> >> > 0000000000000092
> >> >
> >> > (XEN) rdx: 000000000000000a   rsi: 000000000000000a   rdi:
> >> > ffff82c4802237c4
> >> >
> >> > (XEN) rbp: ffff83030d99e310   rsp: ffff82c48035fc48    r8:
> >> > 0000000000000001
> >> >
> >> > (XEN) r9:  0000000000000001   r10: 00000000fffffff8   r11:
> >> > 0000000000000005
> >> >
> >> > (XEN) r12: ffff83050b558000   r13: ffff830626ec5740   r14:
> >> > 0000000000347967
> >> >
> >> > (XEN) r15: ffff83030d99e068   cr0: 0000000080050033   cr4:
> >> > 00000000000026f0
> >> >
> >> > (XEN) cr3: 000000010e642000   cr2: 00002abdc4809000
> >> >
> >> > (XEN) ds: 0000   es: 0000   fs: 0000   gs: 0000   ss: e010   cs: e008
> >> >
> >> > (XEN) Xen stack trace from rsp=ffff82c48035fc48:
> >> >
> >> > (XEN)    000000000001e8dc ffff83030d99e068 0000000000507895
> >> > ffff83030d99e050
> >> >
> >> > (XEN)    ffff82f60a0f12a0 ffff82f60260db80 ffff83030d99e300
> >> > ffff830626afbbd0
> >> >
> >> > (XEN)&nb sp;   0000000080372980 ffff82c48035fe38 ffff83023febe000
> >> > 00000000008f7000
> >> >
> >> > (XEN)    0000000000305000 0000000000000006 0000000000000006
> >> > ffff82c4801c44a4
> >> >
> >> > (XEN)    ffff82c480258188 ffff82c48011cb89 000000000001e8dc
> >> > fffffffffffffff3
> >> >
> >> > (XEN)    ffff82c48035fe28 ffff82c480148503 000003d932971281
> >> > 0000000000000080
> >> >
> >> > (XEN)    000003d9329611d6 ffff82c48018aedf ffff82c4803903a8
> >> > ffff82c48035fd38
> >> >
> >> > (XEN)    ffff82c480390380 ffff82c48035fe28 0000000000000002
> >> > 0000000000000000
> >> >
> >> > (XEN)    0000000000000002 0000000000000000 ffff83023febe000
> >> > ffff83023ff80080
> >> >
> >> > (XEN)    ffff82c48035fe58 0000000000000000 ffff82c48022ca80
> >> > 0000000000000000
> >> >
> >> > (XEN)    0000000000000002 ffff82c48018a 452 0000000000000000
> >> > ffff82c48016f6bb
> >> >
> >> > (XEN)    ffff82c48035fe58 ffff82c4801538ea 000000023ab79067
> >> > fffffffffffffff3
> >> >
> >> > (XEN)    ffff82c48035fe28 00000000008f7000 0000000000305000
> >> > 0000000000000006
> >> >
> >> > (XEN)    0000000000000006 ffff82c4801042b3 0000000000000000
> >> > ffff82c48010d2a5
> >> >
> >> > (XEN)    ffff830477fb51e8 0000000000000000 00007ff000000200
> >> > ffff8300bf76e000
> >> >
> >> > (XEN)    0000000600000039 0000000000000000 00007fc09d744003
> >> > 0000000000325258
> >> >
> >> > (XEN)    0000000000347967 ffffffffff600429 000000004d463b17
> >> > 0000000000062fe2
> >> >
> >> > (XEN)    0000000000000000 00007fc09d744070 00007fc09d744000
> >> > 00007fffcfec0d20
> >> >
> >> > (XEN)    00007fc09d744078 0000000000430fd8 00007fffcfec0d88
> >> > 00000000019f1ca8
> >> >
> >> > (XEN)    0000f05c00000000 00007fc09f4c2718 0000000000000000
> >> > 0000000000000246
> >> >
> >> > (XEN) Xen call trace:
> >> >
> >> > (XEN)    [<ffff82c4801c3760>] mem_sharing_share_pages+0x5b0/0x5d0
> >> >
> >> > (XEN)    [<ffff82c4801c44a4>] mem_sharing_domctl+0xe4/0x130
> >> >
> >> > (XEN)    [<ffff82c48011cb89>] cpumask_raise_softirq+0x89/0xa0
> >> >
> >> > (XEN)    [<ffff82c480148503>] arch_do_domctl+0x14f3/0x22d0
> >> >
> >> > (XEN)    [<ffff82c48018aedf>] handle_hpet_broadcast+0x16f/0x1d0
> >> >
> >> > (XEN)    [<ffff82c48018a452>] hpet_legacy_irq_tick+0x42/0x50
> >> >
> >> > (XEN)    [<ffff82c48016f6bb>] timer_interrupt+0xb/0x130
> >> >
> >> > (XEN)    [<ffff82c4801538ea> ] ack_edge_ioapic_irq+0x2a/0x70
> >> >
> >> > (XEN)    [<ffff82c4801042b3>] do_domctl+0x163/0xfe0
> >> >
> >> > (XEN)    [<ffff82c48010d2a5>] do_grant_table_op+0x75/0x1ad0
> >> >
> >> > (XEN)    [<ffff82c4801e7169>] syscall_enter+0xa9/0xae
> >> >
> >> > (XEN)
> >> >
> >> > (XEN)
> >> >
> >> > (XEN) ****************************************
> >> >
> >> > (XEN) Panic on CPU 0:
> >> >
> >> > (XEN) Xen BUG at mem_sharing.c:798
> >> >
> >> > (XEN) ****************************************
> >> >
> >> > (XEN)
> >> >
> >> > (XEN) Manual reset required ('noreboot' specified)
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > Xen-devel mailing list
> >> > Xen-devel@lists.xensource.com
> >> > http://lists.xensource.com/xen- devel
> >> >
> >> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
> >
> >

-- 
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

^ permalink raw reply

* How To Temporarily Suspend Network Traffic
From: Volkan YAZICI @ 2011-02-01 14:28 UTC (permalink / raw)
  To: netdev

Hi,

I want to temporarily suspend the network traffic on a particular
interface -- if possible, in microsecond granularity. For this purpose,
ifup/ifdown ioctl() calls doesn't work. That is, for wireless
interfaces, connection isn't get recovered; for wired interfaces, it
takes at least 2 seconds to recover. I tried using tc, but it doesn't
accept "rate 0" parameter. Neither "iwconfig wlan0 rate 0" has any
effect. (Moreover, in iwconfig manual it is told that values below 1000
are card specific and are usually an index in the bit-rate list.) Do you
have any suggestions? Can you recommend me to check any code piece in
the kernel or some other tool?


Regards.

^ permalink raw reply

* Re: [Qemu-devel] [PATCH 1/2] Add virtagent file system freeze/thaw
From: Jes Sorensen @ 2011-02-01 14:26 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: agl, qemu-devel, mdroth
In-Reply-To: <AANLkTikGs0SKBVRcNXDKQzcX=a-V3MvTw64ef0K4KHYz@mail.gmail.com>

On 02/01/11 15:12, Stefan Hajnoczi wrote:
> On Tue, Feb 1, 2011 at 10:58 AM,  <Jes.Sorensen@redhat.com> wrote:
>> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>>
>> Implement freeze/thaw support in the guest, allowing the host to
>> request the guest freezes all it's file systems before a live snapshot
>> is performed.
>>  - fsfreeze(): Walk the list of mounted local real file systems,
>>               and freeze them.
>>  - fsthaw():   Walk the list of previously frozen file systems and
>>               thaw them.
>>  - fsstatus(): Return the current status of freeze/thaw. The host must
>>               poll this function, in case fsfreeze() returned with a
>>               timeout, to wait for the operation to finish.
> 
> It is desirable to minimize the freeze time, which may interrupt or
> degrade the service that applications inside the VM can provide.
> Polling means we have to choose a fixed value (500 ms?) at which to
> check for freeze completion.  In this example we could have up to 500
> ms extra time spent in freeze because it completed right after we
> polled.  Any thoughts on this?

I have to admit you lost me here, where do you get that 500ms time from?
Is that the XMLRPC polling time or? I just used the example code from
other agent calls.

> In terms of the fsfreeze(), fsthaw(), fsstatus() API, are you looking
> at Windows Volume Shadow Copy Services and does this API fit that
> model (I haven't looked at it in detail yet)?
> http://msdn.microsoft.com/en-us/library/bb968832(v=vs.85).aspx

I haven't looked at it, I designed the calls based on how they fit with
the Linux ioctls.

>> +       entry = qemu_malloc(sizeof(struct direntry));
>> +       if (!entry) {
>> +           goto fail;
>> +       }
> 
> qemu_malloc() never fails.

Good point, we have ugly malloc in qemu :( I wrote the code to handle
this outside QEMU first, to make sure it worked correctly and trying to
see how many times I could crash my laptop in the process. I'll fix it.

>> +static xmlrpc_value *va_fsfreeze(xmlrpc_env *env,
>> +                                 xmlrpc_value *params,
>> +                                 void *user_data)
>> +{
>> +    xmlrpc_int32 ret = 0, i = 0;
>> +    xmlrpc_value *result;
>> +    struct direntry *entry;
>> +    int fd;
>> +    SLOG("va_fsfreeze()");
>> +
>> +    if (fsfreeze_status == FREEZE_FROZEN) {
>> +        ret = 0;
>> +        goto out;
>> +    }
> 
> The only valid status here is FREEZE_THAWED?  Perhaps we should test
> for that specifically.

Good point, I'll fix this.

>> +
>> +    ret = build_mount_list();
>> +    if (ret < 0) {
>> +        goto out;
>> +    }
>> +
>> +    fsfreeze_status = FREEZE_INPROGRESS;
>> +
>> +    entry = mount_list;
>> +    while(entry) {
>> +        fd = qemu_open(entry->dirname, O_RDONLY);
>> +        if (fd == -1) {
>> +            ret = errno;
>> +            goto error;
>> +        }
>> +        ret = ioctl(fd, FIFREEZE);
> 
> If you close(fd) here then it won't leak or need extra code in the error path.

Good point, will fix.

>> +static xmlrpc_value *va_fsthaw(xmlrpc_env *env,
>> +                               xmlrpc_value *params,
>> +                               void *user_data)
>> +{
>> +    xmlrpc_int32 ret;
>> +    xmlrpc_value *result;
>> +    struct direntry *entry;
>> +    int fd, i = 0;
>> +    SLOG("va_fsthaw()");
>> +
>> +    if (fsfreeze_status == FREEZE_THAWED) {
>> +        ret = 0;
>> +        goto out;
>> +    }
> 
> A stricter check would be status FREEZE_FROZEN.

Yep, will fix

>> +
>> +    while((entry = mount_list)) {
>> +        fd = qemu_open(entry->dirname, O_RDONLY);
>> +        if (fd == -1) {
>> +            ret = -1;
>> +            goto out;
>> +        }
>> +        ret = ioctl(fd, FITHAW);
> 
> Same thing about close(fd) here.

Thanks for the review, all valid points!

Cheers,
Jes

^ permalink raw reply

* [PATCH 3/3] vcs-svn: Refactor dump_export code into dispatch table
From: Ramkumar Ramachandra @ 2011-02-01 14:26 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier, Junio C Hamano
In-Reply-To: <1296570403-9082-1-git-send-email-artagnon@gmail.com>

Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 vcs-svn/dump_export.c |   89 +++++++++++++++++++++++++------------------------
 vcs-svn/dump_export.h |    6 ++-
 2 files changed, 49 insertions(+), 46 deletions(-)

diff --git a/vcs-svn/dump_export.c b/vcs-svn/dump_export.c
index 2b23f77..a8331fd 100644
--- a/vcs-svn/dump_export.c
+++ b/vcs-svn/dump_export.c
@@ -11,6 +11,48 @@
 
 static struct strbuf props;
 
+typedef void state_fn(void);
+
+static void Kfile   (void) { printf("Node-kind: file\n"); }
+static void Kdir    (void) { printf("Node-kind: dir\n"); }
+static void Achange (void) { printf("Node-action: change\n"); }
+static void Aadd    (void) { printf("Node-action: add\n"); }
+static void Adelete (void) { printf("Node-action: delete\n"); }
+static void Areplace(void) { printf("Node-action: replace\n"); }
+static void Pexec   (void) { strbuf_addf(&props, "K 14\nsvn:executable\nV 1\n*\n"); }
+static void Psym    (void) { strbuf_addf(&props, "K 11\nsvn:special\nV 1\n*\n"); }
+static void Pend    (void) { strbuf_add(&props, "PROPS-END\n", 10); }
+
+static void Nchange (void) { Kfile(); Achange(); }
+static void Nadd    (void) { Kfile(); Aadd(); }
+static void Nreplace(void) { Kfile(); Areplace(); }
+static void Echange (void) { Pexec(); Pend(); Kfile(); Achange(); }
+static void Eadd    (void) { Pexec(); Pend(); Kfile(); Aadd(); }
+static void Ereplace(void) { Pexec(); Pend(); Kfile(); Areplace(); }
+static void Schange (void) { Psym(); Pend(); Kfile(); Achange(); }
+static void Sadd    (void) { Psym(); Pend(); Kfile(); Aadd(); }
+static void Sreplace(void) { Psym(); Pend(); Kfile(); Areplace(); }
+static void Dchange (void) { Kdir(); Achange(); }
+static void Dadd    (void) { Kdir(); Aadd(); }
+static void Dreplace(void) { Kdir(); Areplace(); }
+
+static state_fn *const dispatch_table[NODE_KIND_COUNT][NODE_ACTION_COUNT] = {
+	/* NODE_KIND_UNKNOWN */
+	{abort, abort, abort, Adelete, abort},
+	/* NODE_KIND_NORMAL */
+	{abort, Nchange, Nadd, Adelete, Nreplace},
+	/* NODE_KIND_EXECUTABLE */
+	{abort, Echange, Eadd, Adelete, Ereplace},
+	/* NODE_KIND_SYMLINK */
+	{abort, Schange, Sadd, Adelete, Sreplace},
+	/* NODE_KIND_GITLINK */
+	{abort, abort, abort, abort, abort},
+	/* NODE_KIND_DIR */
+	{abort, Dchange, Dadd, Adelete, Dreplace},
+	/* NODE_KIND_SUBDIR */
+	{abort, abort, abort, abort, abort}
+};
+
 void dump_export_begin_rev(int revision, const char *revprops,
 			int prop_len)
 {
@@ -24,56 +66,15 @@ void dump_export_node(const char *path, enum node_kind kind,
 		enum node_action action, unsigned long text_len,
 		unsigned long copyfrom_rev, const char *copyfrom_path)
 {
-	int dump_props = 1; /* Boolean */
 	strbuf_reset(&props);
 	printf("Node-path: %s\n", path);
-	switch (kind) {
-	case NODE_KIND_NORMAL:
-		printf("Node-kind: file\n");
-		break;
-	case NODE_KIND_EXECUTABLE:
-		printf("Node-kind: file\n");
-		strbuf_addf(&props, "K 14\nsvn:executable\nV 1\n*\n");
-		break;
-	case NODE_KIND_SYMLINK:
-		printf("Node-kind: file\n");
-		strbuf_addf(&props, "K 11\nsvn:special\nV 1\n*\n");
-		break;
-	case NODE_KIND_GITLINK:
-		printf("Node-kind: file\n");
-		break;
-	case NODE_KIND_DIR:
-		printf("Node-kind: dir\n");
-		break;
-	case NODE_KIND_SUBDIR:
-		die("Unsupported: subdirectory");
-	default:
-		break;
-	}
-	strbuf_add(&props, "PROPS-END\n", 10);
+	dispatch_table[kind][action]();
 
-	switch (action) {
-	case NODE_ACTION_CHANGE:
-		printf("Node-action: change\n");
-		break;
-	case NODE_ACTION_ADD:
-		printf("Node-action: add\n");
-		break;
-	case NODE_ACTION_REPLACE:
-		printf("Node-action: replace\n");
-		break;
-	case NODE_ACTION_DELETE:
-		printf("Node-action: delete\n");
-		dump_props = 0;
-		break;
-	default:
-		break;
-	}
 	if (copyfrom_rev != SVN_INVALID_REV) {
 		printf("Node-copyfrom-rev: %lu\n", copyfrom_rev);
 		printf("Node-copyfrom-path: %s\n", copyfrom_path);
 	}
-	if (dump_props) {
+	if (props.len) {
 		printf("Prop-delta: false\n");
 		printf("Prop-content-length: %lu\n", props.len);
 	}
@@ -81,7 +82,7 @@ void dump_export_node(const char *path, enum node_kind kind,
 		printf("Text-delta: false\n");		
 		printf("Text-content-length: %lu\n", text_len);
 	}
-	if (text_len || dump_props) {
+	if (text_len || props.len) {
 		printf("Content-length: %lu\n\n", text_len + props.len);
 		printf("%s", props.buf);
 	}
diff --git a/vcs-svn/dump_export.h b/vcs-svn/dump_export.h
index e9f51a3..8265170 100644
--- a/vcs-svn/dump_export.h
+++ b/vcs-svn/dump_export.h
@@ -9,7 +9,8 @@ enum node_action {
 	NODE_ACTION_CHANGE,
 	NODE_ACTION_ADD,
 	NODE_ACTION_DELETE,
-	NODE_ACTION_REPLACE
+	NODE_ACTION_REPLACE,
+	NODE_ACTION_COUNT
 };
 
 enum node_kind {
@@ -19,7 +20,8 @@ enum node_kind {
 	NODE_KIND_SYMLINK,
 	NODE_KIND_GITLINK,
 	NODE_KIND_DIR,           /* SVN-specific */
-	NODE_KIND_SUBDIR
+	NODE_KIND_SUBDIR,
+	NODE_KIND_COUNT
 };
 
 void dump_export_begin_rev(int revision, const char *revprops, int prop_len);
-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply related

* [PATCH 1/3] vcs-svn: Introduce svnload, a dumpfile producer
From: Ramkumar Ramachandra @ 2011-02-01 14:26 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier, Junio C Hamano
In-Reply-To: <1296570403-9082-1-git-send-email-artagnon@gmail.com>

Design-wise, svnload resembles svndump. Include a Makefile rule to
build it into vcs-svn/lib.a.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Makefile              |    4 +-
 vcs-svn/dir_cache.c   |   40 ++++++
 vcs-svn/dir_cache.h   |   12 ++
 vcs-svn/dump_export.c |  149 +++++++++++++++++++++++
 vcs-svn/dump_export.h |   33 +++++
 vcs-svn/svnload.c     |  322 +++++++++++++++++++++++++++++++++++++++++++++++++
 vcs-svn/svnload.h     |   10 ++
 7 files changed, 568 insertions(+), 2 deletions(-)
 create mode 100644 vcs-svn/dir_cache.c
 create mode 100644 vcs-svn/dir_cache.h
 create mode 100644 vcs-svn/dump_export.c
 create mode 100644 vcs-svn/dump_export.h
 create mode 100644 vcs-svn/svnload.c
 create mode 100644 vcs-svn/svnload.h

diff --git a/Makefile b/Makefile
index 1345c38..d9c2442 100644
--- a/Makefile
+++ b/Makefile
@@ -1834,9 +1834,9 @@ ifndef NO_CURL
 endif
 XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 	xdiff/xmerge.o xdiff/xpatience.o
-VCSSVN_OBJS = vcs-svn/line_buffer.o \
+VCSSVN_OBJS = vcs-svn/line_buffer.o vcs-svn/svnload.o vcs-svn/dump_export.o \
 	vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/sliding_window.o \
-	vcs-svn/svndiff.o vcs-svn/svndump.o
+	vcs-svn/svndiff.o vcs-svn/svndump.o vcs-svn/dir_cache.o
 VCSSVN_TEST_OBJS = test-obj-pool.o \
 	test-line-buffer.o test-treap.o test-svn-fe.o
 OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) $(VCSSVN_OBJS)
diff --git a/vcs-svn/dir_cache.c b/vcs-svn/dir_cache.c
new file mode 100644
index 0000000..9a608ce
--- /dev/null
+++ b/vcs-svn/dir_cache.c
@@ -0,0 +1,40 @@
+/*
+ * Licensed under a two-clause BSD-style license.
+ * See LICENSE for details.
+ */
+
+#include "git-compat-util.h"
+#include "string-list.h"
+#include "line_buffer.h"
+#include "dump_export.h"
+
+static struct string_list dirents = STRING_LIST_INIT_DUP;
+static struct string_list_item *dir = NULL;
+
+void dir_cache_add(const char *path, enum node_kind kind) {
+	dir = string_list_insert(&dirents, path);
+	dir->util = malloc(sizeof(enum node_kind));
+	*((enum node_kind *)(dir->util)) = kind;
+}
+
+void dir_cache_remove(const char *path) {
+	dir = string_list_lookup(&dirents, path);
+	if (dir)
+		*((enum node_kind *)(dir->util)) = NODE_KIND_UNKNOWN;
+}
+
+enum node_kind dir_cache_lookup(const char *path) {
+	dir = string_list_lookup(&dirents, path);
+	if (dir)
+		return *((enum node_kind *)(dir->util));
+	else
+		return NODE_KIND_UNKNOWN;
+}
+
+void dir_cache_init() {
+	return;
+}
+
+void dir_cache_deinit() {
+	string_list_clear(&dirents, 1);
+}
diff --git a/vcs-svn/dir_cache.h b/vcs-svn/dir_cache.h
new file mode 100644
index 0000000..43c3797
--- /dev/null
+++ b/vcs-svn/dir_cache.h
@@ -0,0 +1,12 @@
+#ifndef DIR_CACHE_H_
+#define DIR_CACHE_H_
+
+#include "dump_export.h"
+
+void dir_cache_add(const char *path, enum node_kind kind);
+void dir_cache_remove(const char *path);
+enum node_kind dir_cache_lookup(const char *path);
+void dir_cache_init();
+void dir_cache_deinit();
+
+#endif
diff --git a/vcs-svn/dump_export.c b/vcs-svn/dump_export.c
new file mode 100644
index 0000000..2b23f77
--- /dev/null
+++ b/vcs-svn/dump_export.c
@@ -0,0 +1,149 @@
+/*
+ * Licensed under a two-clause BSD-style license.
+ * See LICENSE for details.
+ */
+
+#include "git-compat-util.h"
+#include "strbuf.h"
+#include "line_buffer.h"
+#include "dump_export.h"
+#include "dir_cache.h"
+
+static struct strbuf props;
+
+void dump_export_begin_rev(int revision, const char *revprops,
+			int prop_len)
+{
+	printf("Revision-number: %d\n", revision);
+	printf("Prop-content-length: %d\n", prop_len);
+	printf("Content-length: %d\n\n", prop_len);
+	printf("%s\n", revprops);
+}
+
+void dump_export_node(const char *path, enum node_kind kind,
+		enum node_action action, unsigned long text_len,
+		unsigned long copyfrom_rev, const char *copyfrom_path)
+{
+	int dump_props = 1; /* Boolean */
+	strbuf_reset(&props);
+	printf("Node-path: %s\n", path);
+	switch (kind) {
+	case NODE_KIND_NORMAL:
+		printf("Node-kind: file\n");
+		break;
+	case NODE_KIND_EXECUTABLE:
+		printf("Node-kind: file\n");
+		strbuf_addf(&props, "K 14\nsvn:executable\nV 1\n*\n");
+		break;
+	case NODE_KIND_SYMLINK:
+		printf("Node-kind: file\n");
+		strbuf_addf(&props, "K 11\nsvn:special\nV 1\n*\n");
+		break;
+	case NODE_KIND_GITLINK:
+		printf("Node-kind: file\n");
+		break;
+	case NODE_KIND_DIR:
+		printf("Node-kind: dir\n");
+		break;
+	case NODE_KIND_SUBDIR:
+		die("Unsupported: subdirectory");
+	default:
+		break;
+	}
+	strbuf_add(&props, "PROPS-END\n", 10);
+
+	switch (action) {
+	case NODE_ACTION_CHANGE:
+		printf("Node-action: change\n");
+		break;
+	case NODE_ACTION_ADD:
+		printf("Node-action: add\n");
+		break;
+	case NODE_ACTION_REPLACE:
+		printf("Node-action: replace\n");
+		break;
+	case NODE_ACTION_DELETE:
+		printf("Node-action: delete\n");
+		dump_props = 0;
+		break;
+	default:
+		break;
+	}
+	if (copyfrom_rev != SVN_INVALID_REV) {
+		printf("Node-copyfrom-rev: %lu\n", copyfrom_rev);
+		printf("Node-copyfrom-path: %s\n", copyfrom_path);
+	}
+	if (dump_props) {
+		printf("Prop-delta: false\n");
+		printf("Prop-content-length: %lu\n", props.len);
+	}
+	if (text_len) {
+		printf("Text-delta: false\n");		
+		printf("Text-content-length: %lu\n", text_len);
+	}
+	if (text_len || dump_props) {
+		printf("Content-length: %lu\n\n", text_len + props.len);
+		printf("%s", props.buf);
+	}
+	if (!text_len)
+		printf("\n");
+}
+
+void dump_export_node_r(const char *path, enum node_kind kind,
+			enum node_action action, unsigned long text_len,
+			unsigned long copyfrom_rev, const char *copyfrom_path)
+{
+	char *start, *t;
+	start = (char *) path;
+
+	while ((t = strchr(start, '/'))) {
+			*t = '\0';
+			if (dir_cache_lookup(path) == NODE_KIND_UNKNOWN) {
+				dir_cache_add(path, NODE_KIND_NORMAL);
+				dump_export_node(path, NODE_KIND_DIR,
+						NODE_ACTION_ADD, 0,
+						SVN_INVALID_REV, NULL);
+			}
+			*t = '/';   /* Change it back */
+			start = t + 1;
+	}
+	switch (dir_cache_lookup(path)) {
+	case NODE_KIND_UNKNOWN:
+		action = NODE_ACTION_ADD;
+		break;
+	case NODE_KIND_SYMLINK:
+		dir_cache_remove(path);
+		dump_export_node(path, NODE_KIND_UNKNOWN,
+				NODE_ACTION_DELETE,
+				0, SVN_INVALID_REV, NULL);
+		action = NODE_ACTION_ADD;
+		break;
+	case NODE_KIND_DIR:
+		die("File was previously a directory?");
+		break;
+	case NODE_KIND_SUBDIR:
+		die("Subdirectories unsupported");
+		break;
+	default:
+		action = NODE_ACTION_CHANGE;
+		break;
+	}
+	dir_cache_add(path, kind);
+	dump_export_node(path, kind, action, text_len, copyfrom_rev, copyfrom_path);
+}
+
+void dump_export_text(struct line_buffer *data, off_t len)
+{
+	buffer_copy_bytes(data, len);
+}
+
+void dump_export_init()
+{
+	strbuf_init(&props, MAX_GITSVN_LINE_LEN);
+	printf("SVN-fs-dump-format-version: 3\n\n");
+}
+
+void dump_export_deinit()
+{
+	strbuf_release(&props);
+}
diff --git a/vcs-svn/dump_export.h b/vcs-svn/dump_export.h
new file mode 100644
index 0000000..e9f51a3
--- /dev/null
+++ b/vcs-svn/dump_export.h
@@ -0,0 +1,33 @@
+#ifndef DUMP_EXPORT_H_
+#define DUMP_EXPORT_H_
+
+#define MAX_GITSVN_LINE_LEN 4096
+#define SVN_INVALID_REV 0
+
+enum node_action {
+	NODE_ACTION_UNKNOWN,
+	NODE_ACTION_CHANGE,
+	NODE_ACTION_ADD,
+	NODE_ACTION_DELETE,
+	NODE_ACTION_REPLACE
+};
+
+enum node_kind {
+	NODE_KIND_UNKNOWN,       /* Missing node */
+	NODE_KIND_NORMAL,
+	NODE_KIND_EXECUTABLE,
+	NODE_KIND_SYMLINK,
+	NODE_KIND_GITLINK,
+	NODE_KIND_DIR,           /* SVN-specific */
+	NODE_KIND_SUBDIR
+};
+
+void dump_export_begin_rev(int revision, const char *revprops, int prop_len);
+void dump_export_text(struct line_buffer *data, off_t len);
+void dump_export_node_r(const char *path, enum node_kind kind,
+			enum node_action action, unsigned long text_len,
+			unsigned long copyfrom_rev, const char *copyfrom_path);
+void dump_export_init();
+void dump_export_deinit();
+
+#endif
diff --git a/vcs-svn/svnload.c b/vcs-svn/svnload.c
new file mode 100644
index 0000000..40fc1db
--- /dev/null
+++ b/vcs-svn/svnload.c
@@ -0,0 +1,322 @@
+/*
+ * Produce a dumpfile v3 from a fast-import stream.
+ * Load the dump into the SVN repository with:
+ * svnrdump load <URL> <dumpfile
+ *
+ * Licensed under a two-clause BSD-style license.
+ * See LICENSE for details.
+ */
+
+#include "cache.h"
+#include "git-compat-util.h"
+#include "line_buffer.h"
+#include "dump_export.h"
+#include "dir_cache.h"
+
+#define SVN_DATE_FORMAT "%Y-%m-%dT%H:%M:%S.000000Z"
+#define SVN_DATE_LEN 27
+#define LENGTH_UNKNOWN (~0)
+
+static struct line_buffer input = LINE_BUFFER_INIT;
+
+static struct {
+	unsigned long prop_len, text_len, copyfrom_rev;
+	int text_delta, prop_delta; /* false=0, true=1, unknown=-1 */
+	enum node_action action;
+	enum node_kind kind;
+	struct strbuf copyfrom_path, path;
+} node_ctx;
+
+static struct {
+	int rev, text_len;
+	struct strbuf props, log;
+	struct strbuf svn_author, author, committer;
+	struct strbuf author_date, committer_date;
+	struct strbuf author_email, committer_email;
+} rev_ctx;
+
+static enum {
+	UNKNOWN_CTX,
+	COMMIT_CTX,
+	BLOB_CTX
+} active_ctx;
+
+static void populate_revprops(struct strbuf *props, size_t author_len,
+			const char *author, size_t log_len, const char *log,
+			size_t date_len, const char *date)
+{
+	strbuf_reset(props);
+	strbuf_addf(props, "K 10\nsvn:author\nV %lu\n%s\n", author_len, author);
+	strbuf_addf(props, "K 7\nsvn:log\nV %lu\n%s\n", log_len, log);
+	if (date_len)
+		/* SVN doesn't like an empty svn:date value */
+		strbuf_addf(props, "K 8\nsvn:date\nV %lu\n%s\n", date_len, date);
+	strbuf_add(props, "PROPS-END\n", 10);
+}
+
+static void parse_author_line(char *val, struct strbuf *name,
+			struct strbuf *email, struct strbuf *date)
+{
+	char *t, *tz_off;
+	char time_buf[SVN_DATE_LEN + 1];
+	int tz_off_buf;
+	const struct tm *tm_time;
+
+	/* Author Name <author@email.com> 1170199019 +0530 */
+	strbuf_reset(name);
+	strbuf_reset(email);
+	strbuf_reset(date);
+	if (!val) die("Malformed author line");
+	if (!(tz_off = strrchr(val, ' '))) goto error;
+	*tz_off++ = '\0';
+	if (!(t = strrchr(val, ' '))) goto error;
+	*(t - 1) = '\0'; /* Ignore '>' from email */
+	t++;
+	tz_off_buf = atoi(tz_off);
+	if (tz_off_buf > 1200 || tz_off_buf  < -1200) goto error;
+	tm_time = time_to_tm(strtoul(t, NULL, 10), tz_off_buf);
+	strftime(time_buf, SVN_DATE_LEN + 1, SVN_DATE_FORMAT, tm_time);
+	strbuf_add(date, time_buf, SVN_DATE_LEN);
+	if (!(t = strchr(val, '<'))) goto error;
+	*(t - 1) = '\0'; /* Ignore ' <' from email */
+	t++;
+	strbuf_add(email, t, strlen(t));
+	strbuf_add(name, val, strlen(val));
+	return;
+error:
+	die("Malformed author line: %s", val);
+}
+
+void build_svn_author(struct strbuf *svn_author)
+{
+	char *t, *email;
+
+	strbuf_reset(svn_author);
+	email = rev_ctx.author_email.buf;
+	if (!(t = strchr(email, '@')))
+		goto error;
+	strbuf_add(svn_author, email, t - email);
+	return;
+error:
+	die("Malformed email: %s", email);
+}
+
+int parse_filemodify_mode(char *val)
+{
+	char *t;
+
+	if (!(t = strchr(val, ' '))) goto error;
+	switch (t - val) {
+	case 6:
+		if (!memcmp(val, "100644", 6))
+			node_ctx.kind = NODE_KIND_NORMAL;
+		else if (!memcmp(val, "100755", 6))
+			node_ctx.kind = NODE_KIND_EXECUTABLE;
+		else if (!memcmp(val, "120000", 6))
+			node_ctx.kind = NODE_KIND_SYMLINK;
+		else if (!memcmp(val, "160000", 6))
+			node_ctx.kind = NODE_KIND_GITLINK;
+		else if (!memcmp(val, "040000", 6))
+			node_ctx.kind = NODE_KIND_SUBDIR;
+		else
+			goto error;
+		break;
+	case 3:
+		if (!memcmp(val, "755", 3))
+			node_ctx.kind = NODE_KIND_EXECUTABLE;
+		else if (!memcmp(val, "644", 3))
+			node_ctx.kind = NODE_KIND_NORMAL;
+		else
+			goto error;
+		break;
+	default:
+		goto error;
+	}
+	return t - val + 1;
+error:
+	die("Unrecognized mode: %s", val);
+}
+
+void svnload_read(void)
+{
+	char *t, *val;
+	int len;
+
+	while ((t = buffer_read_line(&input))) {
+		if ((val = strchr(t, ' ')))
+			*val++ = '\0';
+		len = (val ? val - t - 1 : strlen(t));
+
+		switch (len) {
+		case 1:
+			if (!memcmp(t, "D", 1)) {
+				node_ctx.action = NODE_ACTION_DELETE;
+			} else if (!memcmp(t, "C", 1)) {
+				node_ctx.action = NODE_ACTION_ADD;
+			} else if (!memcmp(t, "R", 1)) {
+				node_ctx.action = NODE_ACTION_REPLACE;
+			} else if (!memcmp(t, "M", 1)) {
+				if (!val) goto error;
+				node_ctx.action = NODE_ACTION_CHANGE;
+				val += parse_filemodify_mode(val);
+				if (!(t = strchr(val, ' '))) goto error;
+				*t++ = '\0';
+				strbuf_reset(&node_ctx.path);
+				strbuf_add(&node_ctx.path, t, strlen(t));
+				if (!strncmp(val, "inline", 6))
+					active_ctx = BLOB_CTX;
+				else if (*val == ':')
+					die("Unsupported dataref: marks");
+				else {
+				error:
+					die("Malformed filemodify line: %s", t);
+				}
+			}
+			break;
+		case 2:
+			if (!memcmp(t, "ls", 2))
+				die("ls not supported");
+		case 3:
+			if (!memcmp(t, "tag", 3))
+				continue;
+			break;
+		case 4:
+			if (!memcmp(t, "blob", 4))
+				continue;
+			else if (!memcmp(t, "mark", 4))
+				continue;
+			else if (!memcmp(t, "from", 4))
+				continue;
+			else if (!memcmp(t, "data", 4)) {
+				switch (active_ctx) {
+				case COMMIT_CTX:
+					strbuf_reset(&rev_ctx.log);
+					buffer_read_binary(&input,
+							&rev_ctx.log,
+							strtoul(val, NULL, 10));
+					populate_revprops(&rev_ctx.props,
+							rev_ctx.svn_author.len,
+							rev_ctx.svn_author.buf,
+							rev_ctx.log.len,
+							rev_ctx.log.buf,
+							rev_ctx.author_date.len,
+							rev_ctx.author_date.buf);
+					dump_export_begin_rev(rev_ctx.rev,
+							rev_ctx.props.buf,
+							rev_ctx.props.len);
+					break;
+				case BLOB_CTX:
+					node_ctx.text_len = strtoul(val, NULL, 10);
+					dump_export_node_r(node_ctx.path.buf, node_ctx.kind,
+							node_ctx.action, node_ctx.text_len,
+							SVN_INVALID_REV, NULL);
+					buffer_copy_bytes(&input, node_ctx.text_len);
+					break;
+				default:
+					break;
+				}
+			}
+			break;
+		case 5:
+			if (!memcmp(t, "reset", 5))
+				continue;
+			if (!memcmp(t, "merge", 5))
+				continue;
+			break;
+		case 6:
+			if (!memcmp(t, "author", 6)) {
+				parse_author_line(val, &rev_ctx.author,
+						&rev_ctx.author_email,
+						&rev_ctx.author_date);
+				build_svn_author(&rev_ctx.svn_author);
+			} else if (!memcmp(t, "commit", 6)) {
+				rev_ctx.rev++;
+				active_ctx = COMMIT_CTX;
+			}
+			break;
+		case 8:
+			if (!memcmp(t, "cat-blob", 8))
+				die("cat-blob unsupported");
+			break;
+		case 9:
+			if (!memcmp(t, "deleteall", 9))
+				continue;
+			else if (!memcmp(t, "committer", 9))
+				parse_author_line(val, &rev_ctx.committer,
+						&rev_ctx.committer_email,
+						&rev_ctx.committer_date);
+			break;
+		default:
+			break;
+		}
+	}
+}
+
+static void reset_rev_ctx(int revision)
+{
+	rev_ctx.rev = revision;
+	strbuf_reset(&rev_ctx.props);
+	strbuf_reset(&rev_ctx.log);
+	strbuf_reset(&rev_ctx.svn_author);
+	strbuf_reset(&rev_ctx.author);
+	strbuf_reset(&rev_ctx.committer);
+	strbuf_reset(&rev_ctx.author_date);
+	strbuf_reset(&rev_ctx.committer_date);
+	strbuf_reset(&rev_ctx.author_email);
+	strbuf_reset(&rev_ctx.committer_email);
+}
+
+static void reset_node_ctx(void)
+{
+	node_ctx.prop_len = LENGTH_UNKNOWN;
+	node_ctx.text_len = LENGTH_UNKNOWN;
+	node_ctx.copyfrom_rev = SVN_INVALID_REV;
+	node_ctx.text_delta = -1;
+	node_ctx.prop_delta = -1;
+	strbuf_reset(&node_ctx.copyfrom_path);
+	strbuf_reset(&node_ctx.path);
+}
+
+int svnload_init(const char *filename)
+{
+	if (buffer_init(&input, filename))
+		return error("cannot open %s: %s", filename, strerror(errno));
+	active_ctx = UNKNOWN_CTX;
+	strbuf_init(&rev_ctx.props, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.log, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.author, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.committer, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.svn_author, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.author_date, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.committer_date, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.author_email, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.committer_email, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&node_ctx.path, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&node_ctx.copyfrom_path, MAX_GITSVN_LINE_LEN);
+	dump_export_init();
+	dir_cache_init();
+	return 0;
+}
+
+void svnload_deinit(void)
+{
+	reset_rev_ctx(0);
+	reset_node_ctx();
+	strbuf_release(&rev_ctx.props);
+	strbuf_release(&rev_ctx.log);
+	strbuf_release(&rev_ctx.author);
+	strbuf_release(&rev_ctx.committer);
+	strbuf_release(&rev_ctx.svn_author);
+	strbuf_release(&rev_ctx.author_date);
+	strbuf_release(&rev_ctx.committer_date);
+	strbuf_release(&rev_ctx.author_email);
+	strbuf_release(&rev_ctx.committer_email);
+	strbuf_release(&node_ctx.path);
+	strbuf_release(&node_ctx.copyfrom_path);
+	dump_export_deinit();
+	dir_cache_deinit();
+	if (buffer_deinit(&input))
+		fprintf(stderr, "Input error\n");
+	if (ferror(stdout))
+		fprintf(stderr, "Output error\n");
+}
diff --git a/vcs-svn/svnload.h b/vcs-svn/svnload.h
new file mode 100644
index 0000000..0c8fe8b
--- /dev/null
+++ b/vcs-svn/svnload.h
@@ -0,0 +1,10 @@
+#ifndef SVNLOAD_H_
+#define SVNLOAD_H_
+
+#define SVN_INVALID_REV -1
+
+int svnload_init(const char *filename);
+void svnload_deinit(void);
+void svnload_read(void);
+
+#endif
-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply related

* [PATCH 2/3] t9010-svn-fi: Add tests for svn-fi
From: Ramkumar Ramachandra @ 2011-02-01 14:26 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier, Junio C Hamano
In-Reply-To: <1296570403-9082-1-git-send-email-artagnon@gmail.com>

Create a test-svn-fi in toplevel directory, add rules to build it, and
add some basic tests.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 .gitignore        |    1 +
 Makefile          |    5 +-
 t/t9010-svn-fi.sh |  303 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 test-svn-fi.c     |   20 ++++
 4 files changed, 328 insertions(+), 1 deletions(-)
 create mode 100644 t/t9010-svn-fi.sh
 create mode 100644 test-svn-fi.c

diff --git a/.gitignore b/.gitignore
index b48d1ee..c8c8a17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -177,6 +177,7 @@
 /test-sigchain
 /test-subprocess
 /test-svn-fe
+/test-svn-fi
 /common-cmds.h
 *.tar.gz
 *.dsc
diff --git a/Makefile b/Makefile
index d9c2442..cb21b78 100644
--- a/Makefile
+++ b/Makefile
@@ -431,6 +431,7 @@ TEST_PROGRAMS_NEED_X += test-sha1
 TEST_PROGRAMS_NEED_X += test-sigchain
 TEST_PROGRAMS_NEED_X += test-subprocess
 TEST_PROGRAMS_NEED_X += test-svn-fe
+TEST_PROGRAMS_NEED_X += test-svn-fi
 TEST_PROGRAMS_NEED_X += test-index-version
 
 TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
@@ -1838,7 +1839,7 @@ VCSSVN_OBJS = vcs-svn/line_buffer.o vcs-svn/svnload.o vcs-svn/dump_export.o \
 	vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/sliding_window.o \
 	vcs-svn/svndiff.o vcs-svn/svndump.o vcs-svn/dir_cache.o
 VCSSVN_TEST_OBJS = test-obj-pool.o \
-	test-line-buffer.o test-treap.o test-svn-fe.o
+	test-line-buffer.o test-treap.o test-svn-fe.o test-svn-fi.o
 OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) $(VCSSVN_OBJS)
 
 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
@@ -2129,6 +2130,8 @@ test-parse-options$X: parse-options.o
 
 test-svn-fe$X: vcs-svn/lib.a
 
+test-svn-fi$X: vcs-svn/lib.a
+
 .PRECIOUS: $(TEST_OBJS)
 
 test-%$X: test-%.o $(GITLIBS)
diff --git a/t/t9010-svn-fi.sh b/t/t9010-svn-fi.sh
new file mode 100644
index 0000000..676c7fc
--- /dev/null
+++ b/t/t9010-svn-fi.sh
@@ -0,0 +1,303 @@
+#!/bin/sh
+
+test_description='check svn dumpfile exporter'
+
+. ./test-lib.sh
+
+if ! svnadmin -h >/dev/null 2>&1
+then
+	skip_all='skipping svn-fi tests, svn not available'
+	test_done
+fi
+
+svnrepo="testsvn"
+
+reinit_svn () {
+	rm -rf "$svnrepo" &&
+	rm -f stream &&
+	svnadmin create "$svnrepo" &&
+	printf "#!/bin/sh" > "$svnrepo"/hooks/pre-revprop-change &&
+	chmod +x "$svnrepo"/hooks/pre-revprop-change &&
+	mkfifo stream
+}
+
+svn_look () {
+	subcommand=$1 &&
+	shift &&
+	svnlook "$subcommand" "$svnrepo" "$@"
+}
+
+try_load () {
+	input=$1 &&
+	maybe_fail=${2:+test_$2} &&
+
+	{
+		$maybe_fail test-svn-fi "$input" >stream &
+	} &&
+	svnadmin load "$svnrepo" <stream &&
+	wait $!
+}
+
+test_expect_success 'normal empty files' '
+	reinit_svn &&
+	cat >expect.tree <<-\EOF &&
+	/
+	 foo
+	 bar
+	EOF
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 0
+	M 100644 inline foo
+	data 0
+	M 644 inline bar
+	data 0
+
+	EOF
+	try_load input &&
+	svn_look tree >actual.tree &&
+	test_cmp expect.tree actual.tree
+'
+
+# TODO: How to test date? Need to convert from local timestamp
+test_expect_success 'svn:author and svn:log' '
+	reinit_svn &&
+	echo "nothing" >expect.log &&
+	echo "nobody" >expect.author &&
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 7
+	nothing
+	M 100644 inline foo
+	data 0
+
+	EOF
+	try_load input &&
+	svn_look log >actual.log &&
+	svn_look author >actual.author &&
+	test_cmp expect.log actual.log &&
+	test_cmp expect.author actual.author
+'
+
+test_expect_success 'missing author line' '
+	reinit_svn &&
+	cat >expect.tree <<-\EOF &&
+	/
+	 foo
+	EOF
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 0
+	M 100644 inline foo
+	data 0
+
+	EOF
+	try_load input &&
+	svn_look tree >actual.tree &&
+	test_cmp expect.tree actual.tree
+'
+
+test_expect_success 'blob marks unsupported' '
+	reinit_svn &&
+	cat >input <<-\EOF &&
+	blob
+	mark :1
+	data 0
+
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :2
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 0
+	M 100644 :1 foo
+
+	EOF
+	try_load input must_fail
+'
+
+test_expect_success 'malformed fast-import stream: filemodify' '
+	reinit_svn &&
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 0
+	M 100644 inline
+
+	EOF
+	try_load input must_fail
+'
+
+test_expect_success 'malformed fast-import stream: author' '
+	reinit_svn &&
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author 2d3%*s&f#k|
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 0
+	M 100644 inline foo
+	data 0
+
+	EOF
+	try_load input must_fail
+'
+
+test_expect_success 'malformed fast-import stream: author 2' '
+	reinit_svn &&
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 0
+	M 100644 inline foo
+	data 0
+
+	EOF
+	try_load input must_fail
+'
+
+test_expect_success 'malformed fast-import stream: data length' '
+	reinit_svn &&
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 0
+	M 100644 inline foo
+	data 14238
+
+	EOF
+	test_must_fail try_load input
+'
+
+test_expect_success 'recursive directory creation' '
+	reinit_svn &&
+	cat >expect.tree <<-\EOF &&
+	/
+	 alpha/
+	  beta/
+	   gamma
+	EOF
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 7
+	nothing
+	M 100644 inline alpha/beta/gamma
+	data 12
+	some content
+
+	EOF
+	try_load input &&
+	svn_look tree >actual.tree &&
+	test_cmp expect.tree actual.tree
+'
+
+test_expect_success 'svn:special and svn:executable' '
+	reinit_svn &&
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 7
+	nothing
+	M 100755 inline foo
+	data 0
+	M 755 inline moo
+	data 0
+	M 120000 inline bar
+	data 0
+
+	EOF
+	try_load input &&
+	svn_look propget svn:executable foo &&
+	svn_look propget svn:executable moo &&
+	svn_look propget svn:special bar
+'
+
+test_expect_success 'replace symlink with normal file' '
+	reinit_svn &&
+	cat >expect.tree <<-\EOF &&
+	/
+	 alpha/
+	  beta/
+	   gamma
+	EOF
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 7
+	nothing
+	M 120000 inline alpha/beta/gamma
+	data 0
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 7
+	nothing
+	M 100644 inline alpha/beta/gamma
+	data 0
+
+	EOF
+	try_load input &&
+	svn_look tree -r1 >actual.tree1 &&
+	svn_look tree -r2 >actual.tree2 &&
+	test_cmp expect.tree actual.tree1 &&
+	test_cmp expect.tree actual.tree2
+'
+
+test_expect_success 'path includes symlink' '
+	reinit_svn &&
+	cat >input <<-\EOF &&
+	reset refs/heads/master
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 7
+	nothing
+	M 120000 inline alpha/beta/gamma
+	data 0
+	commit refs/heads/master
+	mark :1
+	author nobody <nobody@localhost> 1170199019 +0100
+	committer nobody <nobody@localhost> 1170199019 +0100
+	data 7
+	nothing
+	M 100644 inline alpha/beta/gamma/bar
+	data 0
+
+	EOF
+	test_must_fail try_load input
+'
+
+test_done
diff --git a/test-svn-fi.c b/test-svn-fi.c
new file mode 100644
index 0000000..b0605fe
--- /dev/null
+++ b/test-svn-fi.c
@@ -0,0 +1,20 @@
+/*
+ * test-svn-fe: Code to exercise the svn import lib
+ */
+
+#include "git-compat-util.h"
+#include "vcs-svn/svnload.h"
+
+int main(int argc, char *argv[])
+{
+	static const char test_svnfe_usage[] =
+		"test-svn-fe (<dumpfile>";
+	if (argc == 2) {
+		if (svnload_init(argv[1]))
+			return 1;
+		svnload_read();
+		svnload_deinit();
+		return 0;
+	}
+	usage(test_svnfe_usage);
+}
-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply related

* [PATCH v3 0/3] Towards a Git-to-SVN bridge
From: Ramkumar Ramachandra @ 2011-02-01 14:26 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier, Junio C Hamano

Hi,

Here's another attempt. I've omitted 3 patches in this round:
1. The --inline-blobs patch
2. The time_to_tm patch
3. The contrib/svn-fe and test-svn-fi patch
(since those haven't changed from last time)

Changes since last time:
1. Bugfixes and testsuite. All tests pass.
2. Style fixes after Junio's review:
<7v39olok4l.fsf@alter.siamese.dyndns.org>
3. Implemented an experimetal dispatch table suggested by Jonathan:
<20110122191801.GB13023@burratino>

Thanks for reading.

Ramkumar Ramachandra (3):
  vcs-svn: Introduce svnload, a dumpfile producer
  t9010-svn-fi: Add tests for svn-fi
  vcs-svn: Refactor dump_export code into dispatch table

 .gitignore            |    1 +
 Makefile              |    9 +-
 t/t9010-svn-fi.sh     |  303 ++++++++++++++++++++++++++++++++++++++++++++++
 test-svn-fi.c         |   20 +++
 vcs-svn/dir_cache.c   |   40 ++++++
 vcs-svn/dir_cache.h   |   12 ++
 vcs-svn/dump_export.c |  150 +++++++++++++++++++++++
 vcs-svn/dump_export.h |   35 ++++++
 vcs-svn/svnload.c     |  322 +++++++++++++++++++++++++++++++++++++++++++++++++
 vcs-svn/svnload.h     |   10 ++
 10 files changed, 899 insertions(+), 3 deletions(-)
 create mode 100644 t/t9010-svn-fi.sh
 create mode 100644 test-svn-fi.c
 create mode 100644 vcs-svn/dir_cache.c
 create mode 100644 vcs-svn/dir_cache.h
 create mode 100644 vcs-svn/dump_export.c
 create mode 100644 vcs-svn/dump_export.h
 create mode 100644 vcs-svn/svnload.c
 create mode 100644 vcs-svn/svnload.h

-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply

* Re: [PATCH 2/8] bluetooth: add support to register Bluetooth Service
From: Frederic Danis @ 2011-02-01 14:25 UTC (permalink / raw)
  To: ofono
In-Reply-To: <1296507122-10936-2-git-send-email-padovan@profusion.mobi>

[-- Attachment #1: Type: text/plain, Size: 3623 bytes --]

Hello Gustavo,

Le 31/01/2011 21:51, Gustavo F. Padovan a écrit :
> ---
>   plugins/bluetooth.c |   75 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 files changed, 75 insertions(+), 0 deletions(-)
>
> diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
> index dcf75e6..0b5a021 100644
> --- a/plugins/bluetooth.c
> +++ b/plugins/bluetooth.c
> @@ -44,6 +44,43 @@ static GHashTable *adapter_address_hash = NULL;
>   static GSList *server_list = NULL;
>   static gint bluetooth_refcount;
>
> +static const gchar *dun_record = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>	\
> +<record>									\
> +<attribute id=\"0x0001\">							\
> +<sequence>									\
> +<uuid value=\"0x1103\"/>							\
> +</sequence>									\
> +</attribute>									\
> +										\
> +<attribute id=\"0x0004\">							\
> +<sequence>									\
> +<sequence>								\
> +<uuid value=\"0x0100\"/>						\
> +</sequence>								\
> +<sequence>								\
> +<uuid value=\"0x0003\"/>						\
> +<uint8 value=\"%u\" name=\"channel\"/>					\
> +</sequence>								\
> +<sequence>								\
> +<uuid value=\"0x0008\"/>						\
> +</sequence>								\
> +</sequence>									\
> +</attribute>									\
> +										\
> +<attribute id=\"0x0009\">							\
> +<sequence>									\
> +<sequence>								\
> +<uuid value=\"0x1103\"/>						\
> +<uint16 value=\"0x0100\" name=\"version\"/>				\
> +</sequence>								\
> +</sequence>									\
> +</attribute>									\
> +										\
> +<attribute id=\"0x0100\">							\
> +<text value=\"%s\" name=\"name\"/>						\
> +</attribute>									\
> +</record>";
> +
Why do you set the SDP record in the generic bluetooth code ?
I think this should be moved to dun_gw code.

>   struct server {
>   	guint16		service;
>   	gchar		*name;
> @@ -451,12 +488,40 @@ static void new_connection(GIOChannel *io, gpointer user_data)
>   	DBG("%p", server);
>   }
>
> +static void add_record_cb(DBusPendingCall *call, gpointer user_data)
> +{
> +	struct server *server = user_data;
> +	DBusMessage *reply = dbus_pending_call_steal_reply(call);
> +	DBusError derr;
> +	guint32 handle;
> +
> +	dbus_error_init(&derr);
> +
> +	if (dbus_set_error_from_message(&derr, reply)) {
> +		ofono_error("Replied with an error: %s, %s",
> +					derr.name, derr.message);
> +		dbus_error_free(&derr);
> +		server_stop(server);
> +		goto done;
> +	}
> +
> +	dbus_message_get_args(reply, NULL, DBUS_TYPE_UINT32,&handle,
> +					DBUS_TYPE_INVALID);
> +	server->handle = handle;
> +
> +	ofono_info("Registered: %s, handle: 0x%x", server->name, handle);
> +
> +done:
> +	dbus_message_unref(reply);
> +}
> +
>   static void server_start(gpointer data, gpointer user_data)
>   {
>   	struct server *server = data;
>   	char *addr, *path = user_data;
>   	bdaddr_t baddr;
>   	GError *err = NULL;
> +	gchar *xml;
>
>   	if (server->handle != 0)
>   		return;
> @@ -478,6 +543,16 @@ static void server_start(gpointer data, gpointer user_data)
>   	}
>
>   	server->adapter = g_strdup(path);
> +
> +	xml = g_markup_printf_escaped(dun_record, server->channel,
> +					server->name);
> +
> +	bluetooth_send_with_reply(path, BLUEZ_SERVICE_INTERFACE, "AddRecord",
> +					add_record_cb, server, NULL, -1,
> +					DBUS_TYPE_STRING,&xml,
> +					DBUS_TYPE_INVALID);
> +
> +	g_free(xml);
>   }
>
>   static void adapter_properties_cb(DBusPendingCall *call, gpointer user_data)


-- 
Frederic Danis                            Open Source Technology Centre
frederic.danis(a)intel.com                              Intel Corporation


^ permalink raw reply

* Re: [PATCH] ASoC: soc-core: Ensure codec_reg has fixed length fields
From: Liam Girdwood @ 2011-02-01 14:25 UTC (permalink / raw)
  To: Dimitris Papastamos; +Cc: alsa-devel, Mark Brown, patches
In-Reply-To: <1296563048-8137-1-git-send-email-dp@opensource.wolfsonmicro.com>

On Tue, 2011-02-01 at 12:24 +0000, Dimitris Papastamos wrote:
> Make the format of the codec_reg file more easily parsable.  Remove
> the header field which gives the codec name.  These changes are important
> when it comes to extend the debugfs codec_reg file to dump more than
> PAGE_SIZE bytes to make it easier to calculate offsets within the
> file.
> 
> We still need to handle the case when the snd_soc_read() call fails
> and <no data: %d> is outputted.
> 
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
From: James Bottomley @ 2011-02-01 14:25 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: tj, bvanassche, linux-kernel, linux-scsi, brking, rcj
In-Reply-To: <20110201231836D.fujita.tomonori@lab.ntt.co.jp>

On Tue, 2011-02-01 at 23:18 +0900, FUJITA Tomonori wrote:
> On Tue, 1 Feb 2011 11:40:43 +0100
> Tejun Heo <tj@kernel.org> wrote:
> 
> > On Mon, Jan 24, 2011 at 05:24:14PM +0100, Tejun Heo wrote:
> > > Hello,
> > > 
> > > On Mon, Jan 24, 2011 at 05:09:18PM +0100, Bart Van Assche wrote:
> > > > Insertion of  flush_work_sync() fixes a race - that's a good catch.
> > > > flush_work_sync() should be invoked a little earlier though because
> > > > the scheduled work may access the queue destroyed by the
> > > > crq_queue_destroy(target) call. And the CRQ interrupt should be
> > > > disabled from before flush_work_sync() is invoked until after the CRQ
> > > > has been destroyed.
> > > 
> > > Heh, I'm a bit out of my depth here.  If you know what's necessary,
> > > please go ahead and make the change.
> > > 
> > > > Regarding the queue removal: I might have missed something, but why
> > > > would you like to remove the vtgtd work queue ? Since the ibmvstgt
> > > > driver is a storage target driver, processing latency matters. I'm
> > > > afraid that switching from a dedicated queue to the global work queue
> > > > will increase processing latency.
> > > 
> > > Having a dedicated workqueue no longer makes any difference regarding
> > > processing latency.  Each workqueue is mere frontend to the shared
> > > worker pool anyway.  Dedicated workqueues are now meaningful only as
> > > forward progress guarantee, attribute and/or flush domain - IOW, when
> > > the workqueue needs to be used during memory reclaim, the work items
> > > need to have specific attributes or certain group of work items need
> > > to be flushed together.  Apart from that, there's virtually no
> > > difference between using the system_wq and a dedicated one.  As using
> > > the system one is usually simpler, it's natural to do that.
> > 
> > Ping.  Are you interested in doing the conversion?
> 
> FYI, this driver will be replaced shortly. Now I have the working
> ibmvscsis driver for the new target framework. I'll submit it this
> week. So this driver will be removed soon or later (if James prefer to
> go through the proper Documentation/feature-removal-schedule.txt
> process, it'll be for some time). You could leave this alone, I guess.

Whatever works for you is fine by me.  I don't think we need to go
through feature removal since we're not technically removing the
feature.

James

^ permalink raw reply

* Re: What's the typical RAID10 setup?
From: Roberto Spadim @ 2011-02-01 14:25 UTC (permalink / raw)
  To: Jon Nelson; +Cc: David Brown, linux-raid
In-Reply-To: <AANLkTin1MPYZGMuL75c=_q+ndeiz0F5+eCRudpDdTwu9@mail.gmail.com>

nice, english isn´t my language, i´m not offended, i know that we have
problem reading my words... thanks =)

probability using ´raid world words´, isn´t ´mdadm world words´
since mdadm don´t work with disk or ssd (it work with devices)
probability can´t go inside device to try to explain anything without
knowing how mdadm works

if you want global system probability, don´t call mdadm as a source of
probability if you don´t know what it can do.
can a failed mirror be used without sync? no

another point, after a fail (disk) will your system stop or continue?
did you probability consider a fixed point in time or a global
scenario? talking about probability, try to explain the context, and
how to calculate it (it´s necessary, belive me)

using mdadm raid10 how many devices could you lose, for mirror context?
1 mirror, right? losing 1 mirror = losing 1 raid0 disk, right?
if ok, make probability (for mdadm world) with this mirrors, not with disks
use probability with the most secure results, it´s not a academic
probability, it´s a production use software, use secure results.

the original question... how could i make probability about security
for mdadm software? raid1 raid10 raid 5 raid6 raid0, all raid, maybe
the answer could be documentated on raid wiki =), just to don´t get
back again in this mail list
anyone could help with this part of documentation
probability isn´t just numbers, it´s numbers+context
a car can be a vehicle, but a vehicle can be a truck too
probability numbers are nothing without context

2011/2/1 Jon Nelson <jnelson-linux-raid@jamponi.net>:
> On Tue, Feb 1, 2011 at 4:01 AM, David Brown <david@westcontrol.com> wrote:
>> On 31/01/2011 23:52, Keld Jørn Simonsen wrote:
>>>
>>> raid1+0 and Linux MD raid10 are similar, but significantly different
>>> in a number of ways. Linux MD raid10 can run on only 2 drives.
>>> Linux raid10,f2 has almost RAID0 striping performance in sequential read.
>>> You can have an odd number of drives in raid10.
>>> And you can have as many copies as you like in raid10,
>>>
>>
>> You can make raid10,f2 functionality from raid1+0 by using partitions. For
>> example, to get a raid10,f2 equivalent on two drives, partition them into
>> equal halves.  Then make md0 a raid1 mirror of sda1 and sdb2, and md1 a
>> raid1 mirror of sdb1 and sda2.  Finally, make md2 a raid0 stripe set of md0
>> and md1.
>>
>> If you have three disks, you can do that too:
>>
>> md0 = raid1(sda1, sdb2)
>> md1 = raid1(sdb1, sdc2)
>> md2 = raid1(sdc1, sda2)
>> md3 = raid0(md0, md1, md2)
>>
>> As far as I can figure out, the performance should be pretty much the same
>> (although wrapping everything in a single raid10,f2 is more convenient).
>
> The performance will not be the same because. Whenever possible, md
> reads from the outermost portion of the disk -- theoretically the
> fastest portion of the disk (by 2 or 3 times as much as the inner
> tracks) -- and in this way raid10,f2 can actually be faster than
> raid0.
>
>
> --
> Jon
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Roberto Spadim
Spadim Technology / SPAEmpresarial
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] imsm: FIX: size have to be calculated based on first map
From: Adam Kwolek @ 2011-02-01 14:24 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski, wojciech.neubauer

Before reshape finalization migration is still present in metadata.
After patch 'imsm: FIX: crash during getting map'
function get_imsm_map() returns correct value,
this means in our case from second (start) map.

We should calculate map size basing on first (final) map.
For this we should request it by setting second function parameter to '0'

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---

 super-intel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index c70d44b..4565d80 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -5188,7 +5188,7 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
 				int used_disks;
 				struct mdinfo *mdi;
 
-				used_disks = imsm_num_data_members(dev, -1);
+				used_disks = imsm_num_data_members(dev, 0);
 				if (used_disks > 0) {
 					array_blocks =
 						map->blocks_per_member *


^ permalink raw reply related

* [Qemu-devel] Re: [V4 PATCH 5/8] Create support in chroot environment
From: Stefan Hajnoczi @ 2011-02-01 14:23 UTC (permalink / raw)
  To: M. Mohan Kumar; +Cc: qemu-devel
In-Reply-To: <1296538047-16758-1-git-send-email-mohan@in.ibm.com>

On Tue, Feb 1, 2011 at 5:27 AM, M. Mohan Kumar <mohan@in.ibm.com> wrote:
> +    if (setfsuid(request->data.uid) < 0) {
> +        fd_info->fi_error = errno;
> +        return;
> +    }
> +    if (setfsgid(request->data.gid) < 0) {
> +        fd_info->fi_error = errno;
> +        goto unset_uid;
> +    }

fsuid is Linux-specific.  Just something to keep in mind if you wanted
this code to be portable (I think the rest *is* portable).

Stefan

^ permalink raw reply

* Re: [PATCH 01/13] NFNL_SUBSYS_IPSET id and NLA_PUT_NET* macros
From: Patrick McHardy @ 2011-02-01 14:24 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: netfilter-devel, Pablo Neira Ayuso
In-Reply-To: <1296514388-20900-2-git-send-email-kadlec@blackhole.kfki.hu>

Am 31.01.2011 23:52, schrieb Jozsef Kadlecsik:
> The patch adds the NFNL_SUBSYS_IPSET id and NLA_PUT_NET* macros to the vanilla
> kernel.
> 
> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> ---
>  include/linux/netfilter/nfnetlink.h |    3 ++-
>  include/net/netlink.h               |    9 +++++++++
>  2 files changed, 11 insertions(+), 1 deletions(-)

Applied, thanks.

^ permalink raw reply

* [PATCH v2] IB/qib: add thresholds to VendorPortCounters PMA operation
From: Mike Marciniszyn @ 2011-02-01 14:23 UTC (permalink / raw)
  To: Roland Dreier
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	ralph.campbell-h88ZbnxC6KDQT0dZR+AlfA,
	tom.elken-h88ZbnxC6KDQT0dZR+AlfA,
	hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb,
	todd.rimmer-h88ZbnxC6KDQT0dZR+AlfA
In-Reply-To: <20110201142348.9826.83896.stgit-hIFRcJ1SNwcXGO8/Qfapyjg/wwJxntczYPYVAmT7z5s@public.gmane.org>

This adds thresholds to be specified in the VendorPortCounters PMA
operation.

The reserved fields are now defined in the appropriate header file.

Signed-off-by: Mike Marciniszyn <mike.marciniszyn-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org>
---
 drivers/infiniband/hw/qib/qib_mad.c |   97 +++++++++++++++++++++++------------
 drivers/infiniband/hw/qib/qib_mad.h |    5 +-
 2 files changed, 66 insertions(+), 36 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
index 94b0d1f..83305ac 100644
--- a/drivers/infiniband/hw/qib/qib_mad.c
+++ b/drivers/infiniband/hw/qib/qib_mad.c
@@ -1135,14 +1135,16 @@ static int pma_get_classportinfo(struct ib_perf *pmp,
 	p->class_version = 1;
 	p->cap_mask = IB_PMA_CLASS_CAP_EXT_WIDTH;
 	/*
-	 * Set the most significant bit of CM2 to indicate support for
-	 * congestion statistics
-	 */
-	p->reserved[0] = dd->psxmitwait_supported << 7;
-	/*
 	 * Expected response time is 4.096 usec. * 2^18 == 1.073741824 sec.
 	 */
-	p->resp_time_value = 18;
+	p->cap_mask2_resp_time_value = cpu_to_be32(18);
+	if (dd->psxmitwait_supported)
+		/*
+		 * Set the most significant two bits of CM2 to indicate
+		 * support for congestion statistics
+		 */
+		p->cap_mask2_resp_time_value |=
+			IB_PMA_CLASS_CAP_PORT_CONGS;
 
 	return reply((struct ib_smp *) pmp);
 }
@@ -1709,8 +1711,14 @@ static int pma_set_portcounters(struct ib_perf *pmp,
 }
 
 static int pma_set_portcounters_cong(struct ib_perf *pmp,
-				     struct ib_device *ibdev, u8 port)
+				     struct ib_device *ibdev, u8 port,
+				     struct ib_perf *pmp_in)
 {
+	/* Congestion PMA packets start at offset 24 not 64 */
+	struct ib_pma_portcounters_cong *p_out =
+			(struct ib_pma_portcounters_cong *)pmp->reserved;
+	struct ib_pma_portcounters_cong *p_in =
+			(struct ib_pma_portcounters_cong *)pmp_in->reserved;
 	struct qib_ibport *ibp = to_iport(ibdev, port);
 	struct qib_pportdata *ppd = ppd_from_ibp(ibp);
 	struct qib_devdata *dd = dd_from_ppd(ppd);
@@ -1724,36 +1732,56 @@ static int pma_set_portcounters_cong(struct ib_perf *pmp,
 	ret = pma_get_portcounters_cong(pmp, ibdev, port);
 
 	if (counter_select & IB_PMA_SEL_CONG_XMIT) {
-		spin_lock_irqsave(&ppd->ibport_data.lock, flags);
-		ppd->cong_stats.counter = 0;
-		dd->f_set_cntr_sample(ppd, QIB_CONG_TIMER_PSINTERVAL,
-				      0x0);
-		spin_unlock_irqrestore(&ppd->ibport_data.lock, flags);
+		if (p_out->port_xmit_wait > p_in->port_xmit_wait) {
+			spin_lock_irqsave(&ppd->ibport_data.lock, flags);
+			ppd->cong_stats.counter = 0;
+			dd->f_set_cntr_sample(ppd, QIB_CONG_TIMER_PSINTERVAL,
+					      0x0);
+			spin_unlock_irqrestore(&ppd->ibport_data.lock, flags);
+		}
 	}
 	if (counter_select & IB_PMA_SEL_CONG_PORT_DATA) {
-		ibp->z_port_xmit_data = cntrs.port_xmit_data;
-		ibp->z_port_rcv_data = cntrs.port_rcv_data;
-		ibp->z_port_xmit_packets = cntrs.port_xmit_packets;
-		ibp->z_port_rcv_packets = cntrs.port_rcv_packets;
+		if (p_out->port_xmit_data > p_in->port_xmit_data)
+			ibp->z_port_xmit_data = cntrs.port_xmit_data;
+		if (p_out->port_rcv_data > p_in->port_rcv_data)
+			ibp->z_port_rcv_data = cntrs.port_rcv_data;
+		if (p_out->port_xmit_packets > p_in->port_xmit_packets)
+			ibp->z_port_xmit_packets = cntrs.port_xmit_packets;
+		if (p_out->port_rcv_packets > p_in->port_rcv_packets)
+			ibp->z_port_rcv_packets = cntrs.port_rcv_packets;
 	}
 	if (counter_select & IB_PMA_SEL_CONG_ALL) {
-		ibp->z_symbol_error_counter =
-			cntrs.symbol_error_counter;
-		ibp->z_link_error_recovery_counter =
-			cntrs.link_error_recovery_counter;
-		ibp->z_link_downed_counter =
-			cntrs.link_downed_counter;
-		ibp->z_port_rcv_errors = cntrs.port_rcv_errors;
-		ibp->z_port_rcv_remphys_errors =
-			cntrs.port_rcv_remphys_errors;
-		ibp->z_port_xmit_discards =
-			cntrs.port_xmit_discards;
-		ibp->z_local_link_integrity_errors =
-			cntrs.local_link_integrity_errors;
-		ibp->z_excessive_buffer_overrun_errors =
-			cntrs.excessive_buffer_overrun_errors;
-		ibp->n_vl15_dropped = 0;
-		ibp->z_vl15_dropped = cntrs.vl15_dropped;
+		if (p_out->symbol_error_counter > p_in->symbol_error_counter)
+			ibp->z_symbol_error_counter =
+				cntrs.symbol_error_counter;
+		if (p_out->link_error_recovery_counter >
+		    p_in->link_error_recovery_counter)
+			ibp->z_link_error_recovery_counter =
+				cntrs.link_error_recovery_counter;
+		if (p_out->link_downed_counter > p_in->link_downed_counter)
+			ibp->z_link_downed_counter =
+				cntrs.link_downed_counter;
+		if (p_out->port_rcv_errors > p_in->port_rcv_errors)
+			ibp->z_port_rcv_errors = cntrs.port_rcv_errors;
+		if (p_out->port_rcv_remphys_errors >
+		    p_in->port_rcv_remphys_errors)
+			ibp->z_port_rcv_remphys_errors =
+				cntrs.port_rcv_remphys_errors;
+		if (p_out->port_xmit_discards > p_in->port_xmit_discards)
+			ibp->z_port_xmit_discards =
+				cntrs.port_xmit_discards;
+		if ((p_out->lli_ebor_errors & 0xf0) >
+		    (p_in->lli_ebor_errors & 0xf0))
+			ibp->z_local_link_integrity_errors =
+				cntrs.local_link_integrity_errors;
+		if ((p_out->lli_ebor_errors & 0x0f) >
+		    (p_in->lli_ebor_errors & 0x0f))
+			ibp->z_excessive_buffer_overrun_errors =
+				cntrs.excessive_buffer_overrun_errors;
+		if (p_out->vl15_dropped > p_in->vl15_dropped) {
+			ibp->n_vl15_dropped = 0;
+			ibp->z_vl15_dropped = cntrs.vl15_dropped;
+		}
 	}
 
 	return ret;
@@ -2004,7 +2032,8 @@ static int process_perf(struct ib_device *ibdev, u8 port,
 			ret = pma_set_portcounters_ext(pmp, ibdev, port);
 			goto bail;
 		case IB_PMA_PORT_COUNTERS_CONG:
-			ret = pma_set_portcounters_cong(pmp, ibdev, port);
+			ret = pma_set_portcounters_cong(pmp, ibdev, port,
+						(struct ib_perf *)in_mad);
 			goto bail;
 		default:
 			pmp->status |= IB_SMP_UNSUP_METH_ATTR;
diff --git a/drivers/infiniband/hw/qib/qib_mad.h b/drivers/infiniband/hw/qib/qib_mad.h
index 147aff9..b1c7b21 100644
--- a/drivers/infiniband/hw/qib/qib_mad.h
+++ b/drivers/infiniband/hw/qib/qib_mad.h
@@ -187,6 +187,8 @@ struct ib_vl_weight_elem {
 #define IB_PMA_CLASS_CAP_EXT_WIDTH      cpu_to_be16(1 << 9)
 #define IB_PMA_CLASS_CAP_XMIT_WAIT      cpu_to_be16(1 << 12)
 
+#define IB_PMA_CLASS_CAP_PORT_CONGS     cpu_to_be32(3 << 30)
+
 #define IB_PMA_CLASS_PORT_INFO          cpu_to_be16(0x0001)
 #define IB_PMA_PORT_SAMPLES_CONTROL     cpu_to_be16(0x0010)
 #define IB_PMA_PORT_SAMPLES_RESULT      cpu_to_be16(0x0011)
@@ -214,8 +216,7 @@ struct ib_pma_classportinfo {
 	u8 base_version;
 	u8 class_version;
 	__be16 cap_mask;
-	u8 reserved[3];
-	u8 resp_time_value;     /* only lower 5 bits */
+	__be32 cap_mask2_resp_time_value; /* 27, 5 bits respectively */
 	union ib_gid redirect_gid;
 	__be32 redirect_tc_sl_fl;       /* 8, 4, 20 bits respectively */
 	__be16 redirect_lid;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v2] IB/qib: add thresholds to VendorPortCounters PMA operation
From: Mike Marciniszyn @ 2011-02-01 14:23 UTC (permalink / raw)
  To: Roland Dreier
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	ralph.campbell-h88ZbnxC6KDQT0dZR+AlfA,
	tom.elken-h88ZbnxC6KDQT0dZR+AlfA,
	hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb,
	todd.rimmer-h88ZbnxC6KDQT0dZR+AlfA

The patch has been reworked so that the fields used are no longer reserved.

The QLogic PMA has a vendor specific capability.  We are using the top
2 bits of the CapabilityMask2 to indicate the behavior is available.

By not setting the bit 2 in the CapabilityMask, we are indicating that
other PMA clients should ignore CapabilityMask2.

As such no other tools should be confused by our setting of the 2 bits
(because they should not look in CapabilityMask2 anyway).

We purposely do not set the PortXmitWait CapabilityMask bit, this
driver does not implement that capability.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [RFC PATCH 2/2] cgroup/freezer: add per freezer duty ratio control
From: Kirill A. Shutemov @ 2011-02-01 14:23 UTC (permalink / raw)
  To: jacob.jun.pan
  Cc: container cgroup, LKML, Li Zefan, Paul Menage, Arjan van de Ven
In-Reply-To: <1291230012-9536-3-git-send-email-jacob.jun.pan@linux.intel.com>

On Wed, Dec 01, 2010 at 11:00:12AM -0800, jacob.jun.pan@linux.intel.com wrote:
> From: Jacob Pan <jacob.jun.pan@linux.intel.com>
> 
> Freezer subsystem is used to manage batch jobs which can start
> stop at the same time. However, sometime it is desirable to let
> the kernel manage the freezer state automatically with a given
> duty ratio.
> For example, if we want to reduce the time that backgroup apps
> are allowed to run we can put them into a freezer subsystem and
> set the kernel to turn them THAWED/FROZEN at given duty ratio.
> 
> This patch introduces two file nodes
> freezer.duty_ratio and freezer.period_ms
> Usage example, set period to be 50 ms and frozen duty ratio 90%
> [root@localhost aoa]# echo 90 > freezer.duty_ratio
> [root@localhost aoa]# echo 50 > freezer.period_ms
> 
> Each freezer will be controlled by its own kernel thread which is
> in sleep unless there is a state/parameter change.
> 
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
>  kernel/cgroup_freezer.c |  157 ++++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 155 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
> index e7bebb7..07941fa 100644
> --- a/kernel/cgroup_freezer.c
> +++ b/kernel/cgroup_freezer.c
> @@ -21,6 +21,7 @@
>  #include <linux/uaccess.h>
>  #include <linux/freezer.h>
>  #include <linux/seq_file.h>
> +#include <linux/kthread.h>
>  
>  enum freezer_state {
>  	CGROUP_THAWED = 0,
> @@ -28,12 +29,23 @@ enum freezer_state {
>  	CGROUP_FROZEN,
>  };
>  
> +struct freezer_duty {
> +	u32 ratio; /* percentage of time allowed to run */
> +	u32 period; /* period in seconds */

miliseconds, I guess.
And why do you use u32, not int?

> +};
> +
>  struct freezer {
>  	struct cgroup_subsys_state css;
>  	enum freezer_state state;
> +	struct freezer_duty duty;
> +	struct task_struct *fkh;
>  	spinlock_t lock; /* protects _writes_ to state */
>  };
>  
> +static struct task_struct *freezer_task;
> +static int try_to_freeze_cgroup(struct cgroup *cgroup, struct freezer *freezer);
> +static void unfreeze_cgroup(struct cgroup *cgroup, struct freezer *freezer);
> +
>  static inline struct freezer *cgroup_freezer(
>  		struct cgroup *cgroup)
>  {
> @@ -63,6 +75,34 @@ int cgroup_freezing_or_frozen(struct task_struct *task)
>  	return result;
>  }
>  
> +static DECLARE_WAIT_QUEUE_HEAD(freezer_wait);
> +
> +static int freezer_kh(void *data)
> +{
> +	struct cgroup *cgroup = (struct cgroup *)data;
> +	struct freezer *freezer = cgroup_freezer(cgroup);
> +
> +	do {
> +		if (freezer->duty.ratio < 100 && freezer->duty.ratio >= 0 &&
> +			freezer->duty.period) {
> +			if (try_to_freeze_cgroup(cgroup, freezer))
> +				pr_info("cannot freeze\n");
> +			msleep(freezer->duty.period * freezer->duty.ratio);
> +			unfreeze_cgroup(cgroup, freezer);
> +			msleep(freezer->duty.period *
> +				(100 - freezer->duty.ratio));
> +		} else if (freezer->duty.ratio == 100) {
> +			if (try_to_freeze_cgroup(cgroup, freezer))
> +				pr_info("cannot freeze\n");
> +			sleep_on(&freezer_wait);
> +		} else {
> +			sleep_on(&freezer_wait);
> +			pr_debug("freezer thread wake up\n");
> +		}
> +	} while (!kthread_should_stop());
> +	return 0;
> +}
> +
>  /*
>   * cgroups_write_string() limits the size of freezer state strings to
>   * CGROUP_LOCAL_BUFFER_SIZE
> @@ -150,7 +190,11 @@ static struct cgroup_subsys_state *freezer_create(struct cgroup_subsys *ss,
>  static void freezer_destroy(struct cgroup_subsys *ss,
>  			    struct cgroup *cgroup)
>  {
> -	kfree(cgroup_freezer(cgroup));
> +	struct freezer *freezer;
> +
> +	freezer = cgroup_freezer(cgroup);
> +	kthread_stop(freezer->fkh);
> +	kfree(freezer);
>  }
>  
>  /*
> @@ -282,6 +326,51 @@ static int freezer_read(struct cgroup *cgroup, struct cftype *cft,
>  	return 0;
>  }
>  
> +static int freezer_read_duty_ratio(struct cgroup *cgroup, struct cftype *cft,
> +				struct seq_file *m)
> +{
> +	struct freezer *freezer;
> +	u32 duty_ratio;
> +	char result[8];
> +
> +	if (!cgroup_lock_live_group(cgroup))
> +		return -ENODEV;
> +
> +	freezer = cgroup_freezer(cgroup);
> +	spin_lock_irq(&freezer->lock);
> +	duty_ratio = freezer->duty.ratio;
> +	spin_unlock_irq(&freezer->lock);
> +	cgroup_unlock();
> +
> +	sprintf(result, "%d", duty_ratio);
> +	seq_puts(m, result);
> +	seq_putc(m, '\n');
> +	return 0;
> +}
> +
> +static int freezer_read_period(struct cgroup *cgroup, struct cftype *cft,
> +				struct seq_file *m)
> +{
> +	struct freezer *freezer;
> +	u32 period;
> +	char result[8];
> +
> +	if (!cgroup_lock_live_group(cgroup))
> +		return -ENODEV;
> +
> +	freezer = cgroup_freezer(cgroup);
> +	spin_lock_irq(&freezer->lock);
> +	period = freezer->duty.period;
> +	spin_unlock_irq(&freezer->lock);
> +	cgroup_unlock();
> +
> +	sprintf(result, "%d", period);
> +	seq_puts(m, result);
> +	seq_putc(m, '\n');
> +
> +	return 0;
> +}
> +
>  static int try_to_freeze_cgroup(struct cgroup *cgroup, struct freezer *freezer)
>  {
>  	struct cgroup_iter it;
> @@ -368,19 +457,83 @@ static int freezer_write(struct cgroup *cgroup,
>  	return retval;
>  }
>  
> +static int freezer_write_duty_ratio(struct cgroup *cgroup,
> +			 struct cftype *cft,
> +			 const char *buffer)
> +{
> +	struct freezer *freezer;
> +	unsigned long ratio;
> +
> +	if (strict_strtoul(buffer, 10, &ratio) < 0)
> +		return -EINVAL;
> +
> +	if (ratio > 100) {
> +		pr_err("Out of range, ratio should be < 100\n");
> +		return -EINVAL;
> +	}
> +
> +	freezer = cgroup_freezer(cgroup);
> +	spin_lock_irq(&freezer->lock);
> +	freezer->duty.ratio = ratio;
> +	spin_unlock_irq(&freezer->lock);
> +	wake_up(&freezer_wait);
> +
> +	return 0;
> +}
> +
> +static int freezer_write_period(struct cgroup *cgroup,
> +			 struct cftype *cft,
> +			 const char *buffer)
> +{
> +	struct freezer *freezer;
> +
> +	freezer = cgroup_freezer(cgroup);
> +	spin_lock_irq(&freezer->lock);
> +	if (strict_strtoul(buffer, 10, &freezer->duty.period) < 0)
> +		return -EINVAL;

spin_unlock_irq() is missed on error handling.

> +	spin_unlock_irq(&freezer->lock);
> +	wake_up(&freezer_wait);
> +
> +	return 0;
> +}
> +
>  static struct cftype files[] = {
>  	{
>  		.name = "state",
>  		.read_seq_string = freezer_read,
>  		.write_string = freezer_write,
>  	},
> +	{
> +		.name = "duty_ratio",
> +		.read_seq_string = freezer_read_duty_ratio,
> +		.write_string = freezer_write_duty_ratio,
> +	},
> +	{
> +		.name = "period_ms",
> +		.read_seq_string = freezer_read_period,
> +		.write_string = freezer_write_period,
> +	},
>  };
>  
> +#define FREEZER_KH_PREFIX  "freezer_"
>  static int freezer_populate(struct cgroup_subsys *ss, struct cgroup *cgroup)
>  {
> +	int ret = 0;
> +	char thread_name[32];
> +	struct freezer *freezer;
> +
>  	if (!cgroup->parent)
>  		return 0;
> -	return cgroup_add_files(cgroup, ss, files, ARRAY_SIZE(files));
> +
> +	freezer = cgroup_freezer(cgroup);
> +	ret = cgroup_add_files(cgroup, ss, files, ARRAY_SIZE(files));
> +
> +	snprintf(thread_name, 32, "%s%s", FREEZER_KH_PREFIX,
> +		cgroup->dentry->d_name.name);
> +	freezer->fkh = kthread_run(freezer_kh, (void *)cgroup, thread_name);
> +	if (!IS_ERR(freezer_task))
> +		return 0;
> +	return ret;

Why do you create on freezer_populate, not on freezer_create?
And error handling is broken here.

>  }
>  
>  struct cgroup_subsys freezer_subsys = {
> -- 
> 1.7.0.4
> 
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

-- 
 Kirill A. Shutemov

^ permalink raw reply

* Re: [RFC PATCH 2/2] cgroup/freezer: add per freezer duty ratio control
From: Kirill A. Shutemov @ 2011-02-01 14:23 UTC (permalink / raw)
  To: jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA
  Cc: Paul Menage, container cgroup, Arjan van de Ven, LKML
In-Reply-To: <1291230012-9536-3-git-send-email-jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

On Wed, Dec 01, 2010 at 11:00:12AM -0800, jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org wrote:
> From: Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> 
> Freezer subsystem is used to manage batch jobs which can start
> stop at the same time. However, sometime it is desirable to let
> the kernel manage the freezer state automatically with a given
> duty ratio.
> For example, if we want to reduce the time that backgroup apps
> are allowed to run we can put them into a freezer subsystem and
> set the kernel to turn them THAWED/FROZEN at given duty ratio.
> 
> This patch introduces two file nodes
> freezer.duty_ratio and freezer.period_ms
> Usage example, set period to be 50 ms and frozen duty ratio 90%
> [root@localhost aoa]# echo 90 > freezer.duty_ratio
> [root@localhost aoa]# echo 50 > freezer.period_ms
> 
> Each freezer will be controlled by its own kernel thread which is
> in sleep unless there is a state/parameter change.
> 
> Signed-off-by: Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>  kernel/cgroup_freezer.c |  157 ++++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 155 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
> index e7bebb7..07941fa 100644
> --- a/kernel/cgroup_freezer.c
> +++ b/kernel/cgroup_freezer.c
> @@ -21,6 +21,7 @@
>  #include <linux/uaccess.h>
>  #include <linux/freezer.h>
>  #include <linux/seq_file.h>
> +#include <linux/kthread.h>
>  
>  enum freezer_state {
>  	CGROUP_THAWED = 0,
> @@ -28,12 +29,23 @@ enum freezer_state {
>  	CGROUP_FROZEN,
>  };
>  
> +struct freezer_duty {
> +	u32 ratio; /* percentage of time allowed to run */
> +	u32 period; /* period in seconds */

miliseconds, I guess.
And why do you use u32, not int?

> +};
> +
>  struct freezer {
>  	struct cgroup_subsys_state css;
>  	enum freezer_state state;
> +	struct freezer_duty duty;
> +	struct task_struct *fkh;
>  	spinlock_t lock; /* protects _writes_ to state */
>  };
>  
> +static struct task_struct *freezer_task;
> +static int try_to_freeze_cgroup(struct cgroup *cgroup, struct freezer *freezer);
> +static void unfreeze_cgroup(struct cgroup *cgroup, struct freezer *freezer);
> +
>  static inline struct freezer *cgroup_freezer(
>  		struct cgroup *cgroup)
>  {
> @@ -63,6 +75,34 @@ int cgroup_freezing_or_frozen(struct task_struct *task)
>  	return result;
>  }
>  
> +static DECLARE_WAIT_QUEUE_HEAD(freezer_wait);
> +
> +static int freezer_kh(void *data)
> +{
> +	struct cgroup *cgroup = (struct cgroup *)data;
> +	struct freezer *freezer = cgroup_freezer(cgroup);
> +
> +	do {
> +		if (freezer->duty.ratio < 100 && freezer->duty.ratio >= 0 &&
> +			freezer->duty.period) {
> +			if (try_to_freeze_cgroup(cgroup, freezer))
> +				pr_info("cannot freeze\n");
> +			msleep(freezer->duty.period * freezer->duty.ratio);
> +			unfreeze_cgroup(cgroup, freezer);
> +			msleep(freezer->duty.period *
> +				(100 - freezer->duty.ratio));
> +		} else if (freezer->duty.ratio == 100) {
> +			if (try_to_freeze_cgroup(cgroup, freezer))
> +				pr_info("cannot freeze\n");
> +			sleep_on(&freezer_wait);
> +		} else {
> +			sleep_on(&freezer_wait);
> +			pr_debug("freezer thread wake up\n");
> +		}
> +	} while (!kthread_should_stop());
> +	return 0;
> +}
> +
>  /*
>   * cgroups_write_string() limits the size of freezer state strings to
>   * CGROUP_LOCAL_BUFFER_SIZE
> @@ -150,7 +190,11 @@ static struct cgroup_subsys_state *freezer_create(struct cgroup_subsys *ss,
>  static void freezer_destroy(struct cgroup_subsys *ss,
>  			    struct cgroup *cgroup)
>  {
> -	kfree(cgroup_freezer(cgroup));
> +	struct freezer *freezer;
> +
> +	freezer = cgroup_freezer(cgroup);
> +	kthread_stop(freezer->fkh);
> +	kfree(freezer);
>  }
>  
>  /*
> @@ -282,6 +326,51 @@ static int freezer_read(struct cgroup *cgroup, struct cftype *cft,
>  	return 0;
>  }
>  
> +static int freezer_read_duty_ratio(struct cgroup *cgroup, struct cftype *cft,
> +				struct seq_file *m)
> +{
> +	struct freezer *freezer;
> +	u32 duty_ratio;
> +	char result[8];
> +
> +	if (!cgroup_lock_live_group(cgroup))
> +		return -ENODEV;
> +
> +	freezer = cgroup_freezer(cgroup);
> +	spin_lock_irq(&freezer->lock);
> +	duty_ratio = freezer->duty.ratio;
> +	spin_unlock_irq(&freezer->lock);
> +	cgroup_unlock();
> +
> +	sprintf(result, "%d", duty_ratio);
> +	seq_puts(m, result);
> +	seq_putc(m, '\n');
> +	return 0;
> +}
> +
> +static int freezer_read_period(struct cgroup *cgroup, struct cftype *cft,
> +				struct seq_file *m)
> +{
> +	struct freezer *freezer;
> +	u32 period;
> +	char result[8];
> +
> +	if (!cgroup_lock_live_group(cgroup))
> +		return -ENODEV;
> +
> +	freezer = cgroup_freezer(cgroup);
> +	spin_lock_irq(&freezer->lock);
> +	period = freezer->duty.period;
> +	spin_unlock_irq(&freezer->lock);
> +	cgroup_unlock();
> +
> +	sprintf(result, "%d", period);
> +	seq_puts(m, result);
> +	seq_putc(m, '\n');
> +
> +	return 0;
> +}
> +
>  static int try_to_freeze_cgroup(struct cgroup *cgroup, struct freezer *freezer)
>  {
>  	struct cgroup_iter it;
> @@ -368,19 +457,83 @@ static int freezer_write(struct cgroup *cgroup,
>  	return retval;
>  }
>  
> +static int freezer_write_duty_ratio(struct cgroup *cgroup,
> +			 struct cftype *cft,
> +			 const char *buffer)
> +{
> +	struct freezer *freezer;
> +	unsigned long ratio;
> +
> +	if (strict_strtoul(buffer, 10, &ratio) < 0)
> +		return -EINVAL;
> +
> +	if (ratio > 100) {
> +		pr_err("Out of range, ratio should be < 100\n");
> +		return -EINVAL;
> +	}
> +
> +	freezer = cgroup_freezer(cgroup);
> +	spin_lock_irq(&freezer->lock);
> +	freezer->duty.ratio = ratio;
> +	spin_unlock_irq(&freezer->lock);
> +	wake_up(&freezer_wait);
> +
> +	return 0;
> +}
> +
> +static int freezer_write_period(struct cgroup *cgroup,
> +			 struct cftype *cft,
> +			 const char *buffer)
> +{
> +	struct freezer *freezer;
> +
> +	freezer = cgroup_freezer(cgroup);
> +	spin_lock_irq(&freezer->lock);
> +	if (strict_strtoul(buffer, 10, &freezer->duty.period) < 0)
> +		return -EINVAL;

spin_unlock_irq() is missed on error handling.

> +	spin_unlock_irq(&freezer->lock);
> +	wake_up(&freezer_wait);
> +
> +	return 0;
> +}
> +
>  static struct cftype files[] = {
>  	{
>  		.name = "state",
>  		.read_seq_string = freezer_read,
>  		.write_string = freezer_write,
>  	},
> +	{
> +		.name = "duty_ratio",
> +		.read_seq_string = freezer_read_duty_ratio,
> +		.write_string = freezer_write_duty_ratio,
> +	},
> +	{
> +		.name = "period_ms",
> +		.read_seq_string = freezer_read_period,
> +		.write_string = freezer_write_period,
> +	},
>  };
>  
> +#define FREEZER_KH_PREFIX  "freezer_"
>  static int freezer_populate(struct cgroup_subsys *ss, struct cgroup *cgroup)
>  {
> +	int ret = 0;
> +	char thread_name[32];
> +	struct freezer *freezer;
> +
>  	if (!cgroup->parent)
>  		return 0;
> -	return cgroup_add_files(cgroup, ss, files, ARRAY_SIZE(files));
> +
> +	freezer = cgroup_freezer(cgroup);
> +	ret = cgroup_add_files(cgroup, ss, files, ARRAY_SIZE(files));
> +
> +	snprintf(thread_name, 32, "%s%s", FREEZER_KH_PREFIX,
> +		cgroup->dentry->d_name.name);
> +	freezer->fkh = kthread_run(freezer_kh, (void *)cgroup, thread_name);
> +	if (!IS_ERR(freezer_task))
> +		return 0;
> +	return ret;

Why do you create on freezer_populate, not on freezer_create?
And error handling is broken here.

>  }
>  
>  struct cgroup_subsys freezer_subsys = {
> -- 
> 1.7.0.4
> 
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

-- 
 Kirill A. Shutemov

^ permalink raw reply

* Re: [patch 01/28] time: Correct the *settime* parameters
From: Thomas Gleixner @ 2011-02-01 14:22 UTC (permalink / raw)
  To: LKML; +Cc: John Stultz, Richard Cochran, Ingo Molnar, Peter Zijlstra
In-Reply-To: <20110201134417.545698637@linutronix.de>

On Tue, 1 Feb 2011, Thomas Gleixner wrote:

That's missing a From: Richard. Fixed in my local queue.

Thanks,

	tglx

^ permalink raw reply

* Re: [xen-unstable test] 5508: regressions - FAIL
From: George Dunlap @ 2011-02-01 14:22 UTC (permalink / raw)
  To: xen.org; +Cc: xen-devel
In-Reply-To: <osstest-5508-mainreport@xen.org>

On Tue, Feb 1, 2011 at 10:11 AM, xen.org <ian.jackson@eu.citrix.com> wrote:
> flight 5508 xen-unstable real [real]
> http://www.chiark.greenend.org.uk/~xensrcts/logs/5508/
>
> Regressions :-(
>
> Tests which did not succeed and are blocking:
>  test-amd64-xcpkern-i386-pair 16 guest-start                fail REGR. vs. 5503

The guest started but failed to find it rootfs; this sounds like the
intermittent xcpkern failure we mentioned before.

It's a bit hard to look at exactly what might be failing, because the
successful runs actualy don't include any guest console logs!  So I
can't compare a successful boot with an unsuccessful one and see where
it went wrong.

 -George

>
> Tests which are failing intermittently (not blocking):
>  test-i386-xcpkern-i386-pair   8 xen-boot/dst_host            fail pass in 5506
>
> Tests which did not succeed, but are not blocking,
> including regressions (tests previously passed) regarded as allowable:
>  test-amd64-amd64-win         16 leak-check/check             fail   never pass
>  test-amd64-amd64-xl-win       7 windows-install              fail   never pass
>  test-amd64-i386-rhel6hvm-amd  8 guest-saverestore            fail   never pass
>  test-amd64-i386-rhel6hvm-intel  8 guest-saverestore            fail never pass
>  test-amd64-i386-win-vcpus1   16 leak-check/check             fail   never pass
>  test-amd64-i386-win          16 leak-check/check             fail   never pass
>  test-amd64-i386-xl-win-vcpus1  7 windows-install              fail  never pass
>  test-amd64-xcpkern-i386-rhel6hvm-amd  8 guest-saverestore      fail never pass
>  test-amd64-xcpkern-i386-rhel6hvm-intel  8 guest-saverestore    fail never pass
>  test-amd64-xcpkern-i386-win  16 leak-check/check             fail   never pass
>  test-amd64-xcpkern-i386-xl-win  7 windows-install              fail never pass
>  test-i386-i386-win            5 xen-boot                     fail    like 5503
>  test-i386-i386-xl-win         5 xen-boot                     fail    like 5503
>  test-i386-xcpkern-i386-win   16 leak-check/check             fail   never pass
>
> version targeted for testing:
>  xen                  a69965e61ae9
> baseline version:
>  xen                  52e928af3637
>
> ------------------------------------------------------------
> People who touched revisions under test:
>  Ian Campbell <Ian.Campbell@eu.citrix.com>
>  Ian Jackson <ian.jackson@eu.citrix.com>
> ------------------------------------------------------------
>
> jobs:
>  build-i386-xcpkern                                           pass
>  build-amd64                                                  pass
>  build-i386                                                   pass
>  build-amd64-oldkern                                          pass
>  build-i386-oldkern                                           pass
>  build-amd64-pvops                                            pass
>  build-i386-pvops                                             pass
>  test-amd64-amd64-xl                                          pass
>  test-amd64-i386-xl                                           pass
>  test-i386-i386-xl                                            pass
>  test-amd64-xcpkern-i386-xl                                   pass
>  test-i386-xcpkern-i386-xl                                    pass
>  test-amd64-i386-rhel6hvm-amd                                 fail
>  test-amd64-xcpkern-i386-rhel6hvm-amd                         fail
>  test-amd64-i386-xl-credit2                                   pass
>  test-amd64-xcpkern-i386-xl-credit2                           pass
>  test-amd64-i386-rhel6hvm-intel                               fail
>  test-amd64-xcpkern-i386-rhel6hvm-intel                       fail
>  test-amd64-i386-xl-multivcpu                                 pass
>  test-amd64-xcpkern-i386-xl-multivcpu                         pass
>  test-amd64-amd64-pair                                        pass
>  test-amd64-i386-pair                                         pass
>  test-i386-i386-pair                                          pass
>  test-amd64-xcpkern-i386-pair                                 fail
>  test-i386-xcpkern-i386-pair                                  fail
>  test-amd64-amd64-pv                                          pass
>  test-amd64-i386-pv                                           pass
>  test-i386-i386-pv                                            pass
>  test-amd64-xcpkern-i386-pv                                   pass
>  test-i386-xcpkern-i386-pv                                    pass
>  test-amd64-i386-win-vcpus1                                   fail
>  test-amd64-i386-xl-win-vcpus1                                fail
>  test-amd64-amd64-win                                         fail
>  test-amd64-i386-win                                          fail
>  test-i386-i386-win                                           fail
>  test-amd64-xcpkern-i386-win                                  fail
>  test-i386-xcpkern-i386-win                                   fail
>  test-amd64-amd64-xl-win                                      fail
>  test-i386-i386-xl-win                                        fail
>  test-amd64-xcpkern-i386-xl-win                               fail
>
>
> ------------------------------------------------------------
> sg-report-flight on woking.cam.xci-test.com
> logs: /home/xc_osstest/logs
> images: /home/xc_osstest/images
>
> Logs, config files, etc. are available at
>    http://www.chiark.greenend.org.uk/~xensrcts/logs
>
> Test harness code can be found at
>    http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary
>
>
> Not pushing.
>
> ------------------------------------------------------------
> changeset:   22849:a69965e61ae9
> tag:         tip
> user:        Ian Jackson <Ian.Jackson@eu.citrix.com>
> date:        Mon Jan 31 17:47:24 2011 +0000
>
>    Added signature for changeset e7b31cc0093c
>
>
> changeset:   22848:a0a8a15f0b01
> user:        Ian Jackson <Ian.Jackson@eu.citrix.com>
> date:        Mon Jan 31 17:47:13 2011 +0000
>
>    Added tag 4.1.0-rc3 for changeset e7b31cc0093c
>
>
> changeset:   22847:e7b31cc0093c
> tag:         4.1.0-rc3
> user:        Ian Jackson <Ian.Jackson@eu.citrix.com>
> date:        Mon Jan 31 17:46:55 2011 +0000
>
>    Update QEMU_TAG to xen-4.1.0-rc3
>
>
> changeset:   22846:52e928af3637
> user:        Ian Jackson <Ian.Jackson@eu.citrix.com>
> date:        Fri Jan 28 19:37:49 2011 +0000
>
>    libxc: Do not use dom0 physmem as parameter to lzma decoder
>
>    It's not clear why a userspace lzma decode would want to use that
>    particular value, what bearing it has on anything or why it would
>    assume it could use 1/3 of the total RAM in the system (potentially
>    quite a large amount of RAM) as opposed to any other limit number.
>
>    Instead, hardcode 32Mby.
>
>    This reverts 22830:c80960244942, removes the xc_get_physmem/physmem
>    function entirely, and replaces the expression at the call site with a
>    fixed constant.
>
>    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
>    Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
>    Cc: Christoph Egger <Christoph.Egger@amd.com>
>    Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
>
>
> (qemu changes not included)
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>

^ permalink raw reply

* Re: [PATCH 14/22] kvm: Fix race between timer signals and vcpu entry under !IOTHREAD
From: Jan Kiszka @ 2011-02-01 14:21 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Avi Kivity, kvm@vger.kernel.org, qemu-devel@nongnu.org,
	Stefan Hajnoczi
In-Reply-To: <20110201141039.GA14442@amt.cnet>

On 2011-02-01 15:10, Marcelo Tosatti wrote:
> On Tue, Feb 01, 2011 at 02:58:02PM +0100, Jan Kiszka wrote:
>> On 2011-02-01 14:48, Marcelo Tosatti wrote:
>>> On Tue, Feb 01, 2011 at 02:32:38PM +0100, Jan Kiszka wrote:
>>>> On 2011-02-01 13:47, Marcelo Tosatti wrote:
>>>>> On Thu, Jan 27, 2011 at 02:09:58PM +0100, Jan Kiszka wrote:
>>>>>> Found by Stefan Hajnoczi: There is a race in kvm_cpu_exec between
>>>>>> checking for exit_request on vcpu entry and timer signals arriving
>>>>>> before KVM starts to catch them. Plug it by blocking both timer related
>>>>>> signals also on !CONFIG_IOTHREAD and process those via signalfd.
>>>>>>
>>>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>> CC: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
>>>>>> ---
>>>>>>  cpus.c |   18 ++++++++++++++++++
>>>>>>  1 files changed, 18 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> diff --git a/cpus.c b/cpus.c
>>>>>> index fc3f222..29b1070 100644
>>>>>> --- a/cpus.c
>>>>>> +++ b/cpus.c
>>>>>> @@ -254,6 +254,10 @@ static void qemu_kvm_init_cpu_signals(CPUState *env)
>>>>>>      pthread_sigmask(SIG_BLOCK, NULL, &set);
>>>>>>      sigdelset(&set, SIG_IPI);
>>>>>>      sigdelset(&set, SIGBUS);
>>>>>> +#ifndef CONFIG_IOTHREAD
>>>>>> +    sigdelset(&set, SIGIO);
>>>>>> +    sigdelset(&set, SIGALRM);
>>>>>> +#endif
>>>>>
>>>>> I'd prefer separate qemu_kvm_init_cpu_signals in the !IOTHREAD
>>>>> section.
>>>>
>>>> You mean to duplicate qemu_kvm_init_cpu_signals for both configurations?
>>>
>>> Yes, so to avoid #ifdefs spread.
>>
>> Would exchange some #ifdefs against ifndef _WIN32. Haven't measured the
>> delta though.
>>
>>>
>>>>>> +
>>>>>> +#ifndef CONFIG_IOTHREAD
>>>>>> +    if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {
>>>>>> +        qemu_notify_event();
>>>>>> +    }
>>>>>> +#endif
>>>>>
>>>>> Why is this necessary?
>>>>>
>>>>> You should break out of cpu_exec_all if there's a pending alarm (see
>>>>> qemu_alarm_pending()).
>>>>
>>>> qemu_alarm_pending() is not true until the signal is actually taken. The
>>>> alarm handler sets the required flags.
>>>
>>> Right. What i mean is you need to execute the signal handler inside
>>> cpu_exec_all loop (so that alarm pending is set).
>>>
>>> So, if there is a SIGALRM pending, qemu_run_timers has highest
>>> priority, not vcpu execution.
>>
>> We leave the vcpu loop (thanks to notify_event), process the signal in
>> the event loop and run the timer handler. This pattern is IMO less
>> invasive to the existing code, specifically as it is about to die
>> long-term anyway.
> 
> You'll probably see poor timer behaviour on smp guests without iothread
> enabled.
> 

Still checking, but that would mean the notification mechanism is broken
anyway: If IO events do not force us to process them quickly, we already
suffer from latencies in SMP mode.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.