Skip to contentSkip to conversation

Two patches for OVMF build system

PATCH In review Wei Liu 2 participants 12 messages Mar 2, 2015 – Mar 11, 2015

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover Two patches for OVMF build system

Wei Liu (2):
tools: OVMF parallel build
tools: provide distclean target for OVMF

 tools/firmware/ovmf-makefile | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/2 tools: OVMF parallel build

Though it doesn't work with make's "-j" option, the build system of OVMF has an option to specify parallel threads used to run the build.

Using 4 threads to build OVMF looks like a sensible default.

Cc Anthony Perard <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/firmware/ovmf-makefile +2 -4
index 1ad041f..2838744 100644
@@ -1,6 +1,3 @@
-# OVMF building system is not ready yet to run in parallel.
-# Force it to be serial in order to exploit parallelism for neighbors.
-
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
@@ -10,6 +7,7 @@ else
 TARGET=RELEASE
 endif
 
+# OVMF build system has its own parallel building support.
 .NOTPARALLEL:
 MAKEFLAGS  += -j1
 
@@ -18,7 +16,7 @@ all: build
 
 .PHONY: build
 build:
-	OvmfPkg/build.sh -a X64 -b $(TARGET)
+	OvmfPkg/build.sh -a X64 -b $(TARGET) -n 4
 	cp Build/OvmfX64/$(TARGET)_GCC*/FV/OVMF.fd ovmf.bin
 
 .PHONY: clean
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH 2/2 tools: provide distclean target for OVMF

In reply to Wei Liu

OVMF's distclean target was missed in f9c9b1277 (tools: fix "make distclean").

Cc Anthony Perard <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/firmware/ovmf-makefile +3 -0
index 2838744..c922d4d 100644
@@ -22,3 +22,6 @@ build:
 .PHONY: clean
 clean:
 	rm -rf ovmf.bin Build/*
+
+.PHONY: distclean
+distclean: clean
Signature · 1 line
1.9.1
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] tools: OVMF parallel build

In reply to Wei Liu
Quoted 4 lines · Wei Liu

Though it doesn't work with make's "-j" option, the build system of OVMF has an option to specify parallel threads used to run the build.

Using 4 threads to build OVMF looks like a sensible default.

It's a bit arbitrary, but it'll do, I suppose.

It's worth noting that this won't interact with gnu makes token handling which is used to make sure there are only N processes across the recursive build. So this will consume 1 token but launch 4 threads. So if -j4 is used you'll actually get 7 things happening.

I think we can live with that.

So I'm happy with the patch, but I'd like to give others a chance to disagree before applying.

Quoted 2 lines
Cc Anthony Perard <[email protected]>
Quoted 17 lines
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/firmware/ovmf-makefile +0 -3
index 1ad041f..2838744 100644
@@ -1,6 +1,3 @@
-# OVMF building system is not ready yet to run in parallel.
-# Force it to be serial in order to exploit parallelism for neighbors.
-
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 

tools/firmware/ovmf-makefile else · line 12

Quoted 6 lines
tools/firmware/ovmf-makefile +1 -0
@@ -10,6 +7,7 @@ else
 TARGET=RELEASE
 endif
 
+# OVMF build system has its own parallel building support.
 .NOTPARALLEL:
 MAKEFLAGS  += -j1

TBH I'm not sure what if anything these actually do...

Quoted 10 lines
tools/firmware/ovmf-makefile +1 -1
@@ -18,7 +16,7 @@ all: build
 
 .PHONY: build
 build:
-	OvmfPkg/build.sh -a X64 -b $(TARGET)
+	OvmfPkg/build.sh -a X64 -b $(TARGET) -n 4
 	cp Build/OvmfX64/$(TARGET)_GCC*/FV/OVMF.fd ovmf.bin
 
 .PHONY: clean
#7 lore raw

Re: [PATCH 2/2] tools: provide distclean target for OVMF

In reply to Wei Liu
Quoted 2 lines · Wei Liu

OVMF's distclean target was missed in f9c9b1277 (tools: fix "make distclean").

tools/firmware/Makefile has:
subdir-distclean-ovmf: .phony
rm -rf ovmf-dir ovmf-dir-remote

Shouldn't this be avoiding recursing into ovmf-dir in the first place?

Or is there some other reason to want this?

Quoted 20 lines
Cc Anthony Perard <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/firmware/ovmf-makefile +3 -0
index 2838744..c922d4d 100644
@@ -22,3 +22,6 @@ build:
 .PHONY: clean
 clean:
 	rm -rf ovmf.bin Build/*
+
+.PHONY: distclean
+distclean: clean
author
#8 lore raw

Re: [PATCH 2/2] tools: provide distclean target for OVMF

Quoted 4 lines · Ian Campbell
Quoted 2 lines · Wei Liu

OVMF's distclean target was missed in f9c9b1277 (tools: fix "make distclean").

Quoted 8 lines

tools/firmware/Makefile has:
subdir-distclean-ovmf: .phony
rm -rf ovmf-dir ovmf-dir-remote

Shouldn't this be avoiding recursing into ovmf-dir in the first place?

Or is there some other reason to want this?

If you're in firmware directory and do "make distclean", make will recurse into ovmf to do "make distclean".

Wei.

Quoted 21 lines
Quoted 20 lines
Cc Anthony Perard <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/firmware/ovmf-makefile +3 -0
index 2838744..c922d4d 100644
@@ -22,3 +22,6 @@ build:
 .PHONY: clean
 clean:
 	rm -rf ovmf.bin Build/*
+
+.PHONY: distclean
+distclean: clean
#9 lore raw

Re: [PATCH 2/2] tools: provide distclean target for OVMF

Quoted 9 lines · Wei Liu
Quoted 8 lines · Ian Campbell
Quoted 2 lines · Wei Liu

OVMF's distclean target was missed in f9c9b1277 (tools: fix "make distclean").

tools/firmware/Makefile has:
subdir-distclean-ovmf: .phony
rm -rf ovmf-dir ovmf-dir-remote

Quoted 7 lines
Quoted 4 lines

Shouldn't this be avoiding recursing into ovmf-dir in the first place?

Or is there some other reason to want this?

If you're in firmware directory and do "make distclean", make will recurse into ovmf to do "make distclean".

Really? Despite the rule I quoted above? How strange, I wonder why that is.

I'd have expected "make distclean" to behave the same whether run in the directory or recursed into frmo a higher level.

Quoted 24 lines

Wei.

Quoted 21 lines
Quoted 20 lines
Cc Anthony Perard <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/firmware/ovmf-makefile +3 -0
index 2838744..c922d4d 100644
@@ -22,3 +22,6 @@ build:
 .PHONY: clean
 clean:
 	rm -rf ovmf.bin Build/*
+
+.PHONY: distclean
+distclean: clean
author
#10 lore raw

Re: [PATCH 2/2] tools: provide distclean target for OVMF

Quoted 15 lines · Ian Campbell
Quoted 14 lines · Wei Liu
Quoted 12 lines · Ian Campbell
Quoted 2 lines · Wei Liu

OVMF's distclean target was missed in f9c9b1277 (tools: fix "make distclean").

tools/firmware/Makefile has:
subdir-distclean-ovmf: .phony
rm -rf ovmf-dir ovmf-dir-remote

Shouldn't this be avoiding recursing into ovmf-dir in the first place?

Or is there some other reason to want this?

Quoted 9 lines
Quoted 2 lines

If you're in firmware directory and do "make distclean", make will recurse into ovmf to do "make distclean".

Really? Despite the rule I quoted above? How strange, I wonder why that is.

I'd have expected "make distclean" to behave the same whether run in the directory or recursed into frmo a higher level.

The problem is that subdir-distclean-ovmf should have been subdir-distclean-ovmf-dir. I think you prefer I fix it this way?

subidr-clean-ovmf should be -ovmf-dir following the same rule. I shall fix them all in one go.

Wei.

Quoted 25 lines
Quoted 24 lines

Wei.

Quoted 21 lines
Quoted 20 lines
Cc Anthony Perard <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/firmware/ovmf-makefile +3 -0
index 2838744..c922d4d 100644
@@ -22,3 +22,6 @@ build:
 .PHONY: clean
 clean:
 	rm -rf ovmf.bin Build/*
+
+.PHONY: distclean
+distclean: clean
#11 lore raw

Re: [PATCH 2/2] tools: provide distclean target for OVMF

Quoted 22 lines · Wei Liu
Quoted 21 lines · Ian Campbell
Quoted 9 lines · Wei Liu
Quoted 8 lines · Ian Campbell
Quoted 2 lines · Wei Liu

OVMF's distclean target was missed in f9c9b1277 (tools: fix "make distclean").

tools/firmware/Makefile has:
subdir-distclean-ovmf: .phony
rm -rf ovmf-dir ovmf-dir-remote

Quoted 7 lines
Quoted 4 lines

Shouldn't this be avoiding recursing into ovmf-dir in the first place?

Or is there some other reason to want this?

If you're in firmware directory and do "make distclean", make will recurse into ovmf to do "make distclean".

Really? Despite the rule I quoted above? How strange, I wonder why that is.

Quoted 6 lines
Quoted 3 lines

I'd have expected "make distclean" to behave the same whether run in the directory or recursed into frmo a higher level.

The problem is that subdir-distclean-ovmf should have been subdir-distclean-ovmf-dir. I think you prefer I fix it this way?

You guessed right!

Quoted 2 lines

subidr-clean-ovmf should be -ovmf-dir following the same rule. I shall fix them all in one go.

Yes please.

Quoted 28 lines

Wei.

Quoted 25 lines
Quoted 24 lines

Wei.

Quoted 21 lines
Quoted 20 lines
Cc Anthony Perard <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/firmware/ovmf-makefile +3 -0
index 2838744..c922d4d 100644
@@ -22,3 +22,6 @@ build:
 .PHONY: clean
 clean:
 	rm -rf ovmf.bin Build/*
+
+.PHONY: distclean
+distclean: clean
author
#3 lore raw

Re: [PATCH 1/2] tools: OVMF parallel build

In reply to Ian Campbell
Quoted 43 lines · Ian Campbell
Quoted 4 lines · Wei Liu

Though it doesn't work with make's "-j" option, the build system of OVMF has an option to specify parallel threads used to run the build.

Using 4 threads to build OVMF looks like a sensible default.

It's a bit arbitrary, but it'll do, I suppose.

It's worth noting that this won't interact with gnu makes token handling which is used to make sure there are only N processes across the recursive build. So this will consume 1 token but launch 4 threads. So if -j4 is used you'll actually get 7 things happening.

I think we can live with that.

So I'm happy with the patch, but I'd like to give others a chance to disagree before applying.

Quoted 2 lines
Cc Anthony Perard <[email protected]>
Quoted 20 lines
Cc Ian Jackson <[email protected]>
---
 tools/firmware/ovmf-makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/firmware/ovmf-makefile +0 -3
index 1ad041f..2838744 100644
@@ -1,6 +1,3 @@
-# OVMF building system is not ready yet to run in parallel.
-# Force it to be serial in order to exploit parallelism for neighbors.
-
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
@@ -10,6 +7,7 @@ else
 TARGET=RELEASE
 endif
 
Quoted 6 lines

tools/firmware/ovmf-makefile else · line 12

Quoted 3 lines
tools/firmware/ovmf-makefile +1 -0
+# OVMF build system has its own parallel building support.
 .NOTPARALLEL:
 MAKEFLAGS  += -j1

TBH I'm not sure what if anything these actually do...

Without this OVMF won't build. It plays with MAKEFLAGS to enforce there is only one thread used. I haven't really looked into whether it's the correct rune but it seems to work fine.

Wei.

Quoted 11 lines
Quoted 10 lines
tools/firmware/ovmf-makefile +1 -1
@@ -18,7 +16,7 @@ all: build
 
 .PHONY: build
 build:
-	OvmfPkg/build.sh -a X64 -b $(TARGET)
+	OvmfPkg/build.sh -a X64 -b $(TARGET) -n 4
 	cp Build/OvmfX64/$(TARGET)_GCC*/FV/OVMF.fd ovmf.bin
 
 .PHONY: clean
#4 lore raw

Re: [PATCH 1/2] tools: OVMF parallel build

In reply to Ian Campbell
Quoted 13 lines · Ian Campbell
Quoted 4 lines · Wei Liu

Though it doesn't work with make's "-j" option, the build system of OVMF has an option to specify parallel threads used to run the build.

Using 4 threads to build OVMF looks like a sensible default.

It's a bit arbitrary, but it'll do, I suppose.

It's worth noting that this won't interact with gnu makes token handling which is used to make sure there are only N processes across the recursive build. So this will consume 1 token but launch 4 threads. So if -j4 is used you'll actually get 7 things happening.

Quoted 4 lines

I think we can live with that.

So I'm happy with the patch, but I'd like to give others a chance to disagree before applying.

They had their chance...

Quoted 5 lines
Quoted 3 lines
Cc Anthony Perard <[email protected]>

... applied.

Did the distclean issue which the second patch was addressing get fixed another way or is there a patch outstanding somewhere?

author
#5 lore raw

Re: [PATCH 1/2] tools: OVMF parallel build

Quoted 24 lines · Ian Campbell
Quoted 13 lines · Ian Campbell
Quoted 4 lines · Wei Liu

Though it doesn't work with make's "-j" option, the build system of OVMF has an option to specify parallel threads used to run the build.

Using 4 threads to build OVMF looks like a sensible default.

It's a bit arbitrary, but it'll do, I suppose.

It's worth noting that this won't interact with gnu makes token handling which is used to make sure there are only N processes across the recursive build. So this will consume 1 token but launch 4 threads. So if -j4 is used you'll actually get 7 things happening.

Quoted 4 lines

I think we can live with that.

So I'm happy with the patch, but I'd like to give others a chance to disagree before applying.

They had their chance...

Quoted 4 lines
Quoted 3 lines
Cc Anthony Perard <[email protected]>
Quoted 6 lines
Quoted 1 line

... applied.

Did the distclean issue which the second patch was addressing get fixed another way or is there a patch outstanding somewhere?

Urgh. I thought I posted it somewhere, but apparently I was wrong.

I will send it now.

Wei.