๐Ÿ“ฝ๏ธ

VS Code ๋„ˆ๊ฐ€ ์žˆ์–ด ํŽธ๋ฆฌํ•œ Git, ๋ค์œผ๋กœ ๋ณด๋Š” ์˜คํ”ˆ์†Œ์Šค ๊ธฐ์—ฌ ๐Ÿค—

10๋ถ„ ์•ˆ์— ์‚ดํŽด๋ณด๋Š” VS Code โ†’ Github or Mailing ๊ธฐ๋ฐ˜ ์˜คํ”ˆ์†Œ์Šค ๊ธฐ์—ฌํ•˜๊ธฐ

์ธ์ง€๊ธฐ์ˆ ํŒ€ ๊น€์œค์„ฑ

VS Code ๋ฅผ ํ™œ์šฉํ•œ Git

  • ๋งˆ์ดํฌ๋กœ์†Œํ”„ํŠธ ์œˆ๋„์šฐ, macOS, ๋ฆฌ๋ˆ…์Šค์šฉ์œผ๋กœ electron(node.js) ๊ธฐ๋ฐ˜ ํŽธ์ง‘๊ธฐ์ž…๋‹ˆ๋‹ค.
  • Plugin ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ํ’๋ถ€ํ•œ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง„ IDE ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • VS Code ์ž์ฒด์ ์œผ๋กœ ์ง€์›ํ•˜๋Š” Git ๊ธฐ๋Šฅ์ด ์ฐธ ํŽธ๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
    • ์ฒ ๊ถŒ์ฒ˜๋Ÿผ ์ปค๋งจ๋“œ๋ฅผ ์กฐํ•ฉํ•˜์—ฌ ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๋ฒ„ํŠผ ํ•˜๋‚˜๋กœ ํ•จ์ถ•ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์ถ”๊ฐ€์ ์œผ๋กœ Git ๊ธฐ๋Šฅ ์™ธ์—๋„ SSH ๋˜๋Š” Live Share ์›๊ฒฉ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๋ฐ ๋ฉ€ํ‹ฐ ์œ ์ € ํŽธ์ง‘์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

Git Command

๊ทธ๋ฆผ 2 : Git ์ปค๋งจ๋“œ ์š”์•ฝ๋ณธ

VS Code ๋ฅผ ํ™œ์šฉํ•œ Git

๊ทธ๋ฆผ 1 : VS Code ์—์„œ Git

Git History

  • History ๊ทธ๋ž˜ํ”„๋ฅผ ๋ณผ ๋•Œ ์œ ์šฉํ•œ Git History ํ”Œ๋Ÿฌ๊ทธ์ธ
  • ์ปค๋ฐ‹ ํžˆ์Šคํ† ๋ฆฌ๋ฅผ ๋ณด๊ธฐ ์œ„ํ•œ git log, ํŠน์ • ์ปค๋ฐ‹์˜ ์‹œ์ ์œผ๋กœ ๋ฐ”๊พธ๋Š” git checkout ์— ๋Œ€์‘ํ•˜๋Š” ๊ธฐ๋Šฅ์ธ๋ฐ ์ง๊ด€์ ์œผ๋กœ ๋ณด๊ธฐ ํŽธํ•ฉ๋‹ˆ๋‹ค.

Git History

Git Lens

  • ์ฝ”๋“œ ๋ผ์ธ & ํŒŒ์ผ ๋ณ„ ํžˆ์Šคํ† ๋ฆฌ ์ถ”์ ์— ์šฉ์ดํ•œ Git Lens ํ”Œ๋Ÿฌ๊ทธ์ธ

Git Lens

CONTRIBUTING

  • ์˜คํ”ˆ์†Œ์Šค ํ”„๋กœ์ ํŠธ
    • Github, Gitlab, cgit ๋“ฑ์˜ git ๊ธฐ๋ฐ˜ ํ˜ธ์ŠคํŒ…์— ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋“ค
  • ๊ฐ ํ”„๋กœ์ ํŠธ์— Core, Util, Docs, unit-test, run-test, CI/CD ๋“ฑ์— ๊ธฐ์—ฌํ•ฉ๋‹ˆ๋‹ค.
      1. ๊ฒŒ์‹œํŒ ํ˜•ํƒœ์˜ ํ”Œ๋žซํผ์€ issue ๋ฅผ ํ™•์ธ
      1. ๋ฉ”์ผ๋ง ๊ธฐ๋ฐ˜์€ ๋ฉ”์ผ๋ง ๋“ฑ๋ก
  • wiki ๋˜๋Š” ์†Œ์Šค ์ตœ์ƒ๋‹จ ์ปจํŠธ๋ฆฌ๋ทฐ์…˜ ๊ฐ€์ด๋“œ ๋ฌธ์„œ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.

Contribution - Review

๊ตญ์ œ์ ์œผ๋กœ ๋ฉ”์ผ๋ง ๊ธฐ๋ก์ด ๋‚จ๊ธฐ ๋•Œ๋ฌธ์—,
๋ฉ”์ธํ…Œ์ด๋„ˆ๋“ค์ด ์‚ฌ์†Œํ•œ ํŒจ์น˜๋ผ๋„ ์‹ ์ค‘ํ•˜๊ฒŒ ๋ฆฌ๋ทฐํ•ด์ค๋‹ˆ๋‹ค.


ํŠนํžˆ, Pull Request(ํŒจ์น˜)๋ฅผ ๋ณด๋‚ธ ๊ธฐ์—ฌ์ž๋ฅผ ์„ค๋“ํ•˜๊ธฐ ์œ„ํ•ด์„œ
์–ด๋ ค์šด ๋™์ž‘์„ ์ž์„ธํžˆ ์„ค๋ช…ํ•ด์ฃผ์–ด ๋งŽ์€ ๋„์›€์ด ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Github Uftrace - Commit

์ฝ”๋“œ ์ •์  ๋ถ„์„๊ธฐ๋กœ ๋‚˜์˜จ ํ•ญ๋ชฉ ์ค‘์— Null ๊ด€๋ จ ๋ณด์•ˆ ์‚ฌํ•ญ์„ ํ™•์ธํ•œ ํ›„ ํŒจ์น˜๋ฅผ ํ•ด๋ด…๋‹ˆ๋‹ค.

cmds/graph.c:282: error: Null Dereference
  pointer `graph` last assigned on line 279 could be null 
  and is dereferenced at line 282, column 3.
  281.  if (tg->utg.graph && tg->utg.graph != graph) {
  282.          pr_dbg("detect new session: %.*s\n", SESSION_ID_LEN, graph->sess->sid);
         ^

๊นƒํ—ˆ๋ธŒ ์ด์Šˆ๋กœ ๋“ฑ๋กํ•œ ๋’ค์— ํ•ด๋‹น ์‚ฌํ•ญ์„ ๋ณด์™„ํ•˜๋Š” ์ž‘์—…์„ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
Commit

Before PR

์ปค๋ฐ‹์„ ํ•˜๊ณ  ๋‚œ ๋’ค์— ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹ ์‹คํ–‰ ์ทจ์†Œ๋กœ ์‰ฝ๊ฒŒ ์Šคํ…Œ์ด์ง• ๋‹จ๊ณ„๋กœ ๋˜๋Œ์•„ ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ฝ”๋“œ๋ฆฌ๋ทฐ๋ฅผ ๋ฐ›๊ณ  ๋ณด์™„ํ•  ๋ถ€๋ถ„์ด ์žˆ๋‹ค๋ฉด, ํ™œ์šฉํ•˜๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค.

Before PR

Before PR

์ปค๋ฐ‹ํ•˜๊ณ  ํ‘ธ์‰ฌ๋กœ origin ๋ธŒ๋žœ์น˜์— ๋ฐ˜์˜๋˜์—ˆ๋Š”๋ฐ ๋˜ ์ˆ˜์ •์ด ํ•„์š”ํ•˜๋‹ค๋ฉด?
์ˆ˜์ • ์ปค๋ฐ‹์„ origin์— ์˜ฌ๋ผ๊ฐ„ ๋ธŒ๋žœ์น˜์— ์Œ“์ง€ ์•Š๊ณ (๋ณดํ†ต ์ปค๋ฐ‹ ํžˆ์Šคํ† ๋ฆฌ ๊ด€๋ฆฌํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ข‹์•„ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.) ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹์„ ์ˆ˜์ •ํ•˜์—ฌ git push -f ๋กœ ๋ฎ์–ด ์จ์ค๋‹ˆ๋‹ค.

commit-rollback-update-origin-branch.png

PR

fork ํ•œ ๋ธŒ๋žœ์น˜(Downstream)๋ฅผ origin(Upstream)์— ๋จธ์ง€ํ•  ์ˆ˜ ์žˆ๋„๋ก Pull Request ์„ ์ž‘์„ฑํ•˜๋Š” ๋‹จ๊ณ„์ž…๋‹ˆ๋‹ค. Pull Request ๋Š” ๋‹น๊น€์„ ์š”์ฒญํ•œ๋‹ค. ์ฆ‰, ์˜คํ”ˆ์†Œ์Šค ๋ฉ”์ธํ…Œ์ด๋„ˆ์—๊ฒŒ ๋‚ด ์†Œ์Šค๋ฅผ ์žก์•„ ๋‹น๊ฒจ์„œ ๋„ฃ์œผ๋ผ๋Š” ์˜๋ฏธ์ž…๋‹ˆ๋‹ค.

PR

Linux Kernel - Send Patch

์†Œ์Šค ์ตœ์ƒ๋‹จ์˜ MAINTAINERS ์ฐธ๊ณ ํ•˜์—ฌ github ์™€ 1 ~ 2 ์™€ ์œ ์‚ฌํ•˜์ง€๋งŒ, Pull Request๊ณผ ์ฝ”๋“œ ๋ฆฌ๋ทฐ๋ฅผ ๋ชจ๋‘ ๋‹ด๋‹น์ž์˜ ๋ฉ”์ผ๋กœ ๋ณด๋ƒ…๋‹ˆ๋‹ค.

git send-email --smtp-pass="๋น„๋ฐ€๋ฒˆํ˜ธ" \
  --to="๋ฉ”์ธํ…Œ์ด๋„ˆ@์ด๋ฉ”์ผ.์ฃผ์†Œ" \
  --cc="์ฐธ์กฐํ• @๋ฉ”์ผ.์ฃผ์†Œ๋“ค" \
  --confirm=always -M -1

๋’ค์— ์นด์šดํŠธ๋Š” ์ž‘์—…ํ•œ ์ปค๋ฐ‹ ๊ฐœ์ˆ˜๋ฅผ ๋„ฃ์Šต๋‹ˆ๋‹ค.

git send-email \
  --to="Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <maz@kernel.org>"
  --cc="linux-kernel@vger.kernel.org, Austin Kim <austindh.kim@gmail.com>"
  --confirm=always -M -1

Send Patch(Cont’d)

์ปค๋ฐ‹ ๋ฉ”์„ธ์ง€๋ฅผ ์ž‘์„ฑํ•  ๋•Œ, ์˜์–ด ์ž‘๋ฌธ ์‹ค๋ ฅ์ด ํ•„์š”ํ•˜์ง€๋งŒ,
์šฐ๋ฆฌ์—๊ฒ ๊ตฌ๊ธ€ ๋ฒˆ์—ญ๊ธฐ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

Hello

Since we have a macro defined in our IRQ subsystem internal functions to
traverse the list of actions, how about refactoring this loop?

- genirq: Use a common macro to go through the actions list
(f944b5a7aff05a244a6c8cac297819af09a199e4)

have a good day!

---
 kernel/irq/irqdesc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 939d21cd55c3..34a0cefff712 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -246,12 +246,12 @@ static ssize_t actions_show(struct kobject *kobj,
 			    struct kobj_attribute *attr, char *buf)
 {
 	struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj);
-	struct irqaction *action;
+	struct irqaction *action = NULL;
 	ssize_t ret = 0;
 	char *p = "";
 
 	raw_spin_lock_irq(&desc->lock);
-	for (action = desc->action; action != NULL; action = action->next) {
+	for_each_action_of_desc(desc, action) {
 		ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%s",
 				 p, action->name);
 		p = ",";
-- 

Maintainer’s Code Review

ํ•ด๋‹น ์„œ๋ธŒ์‹œ์Šคํ…œ์˜ ๋ฉ”์ธํ…Œ์ด๋„ˆ๊ฐ€ ๋ณด๋‚ธ ํŒจ์น˜์— ๋Œ€ํ•ด์„œ ๋ณด์™„ํ•ด์•ผํ•  ์‚ฌํ•ญ์„ ๋ฆฌ๋ทฐํ•ด์ค๋‹ˆ๋‹ค.

Re: [PATCH] genirq: Refactor actions_show loop block using a common macro to go through the actions list
    - by Thomas Gleixner @ 2022-04-10 19:17 UTC [7%]

On Fri, Apr 08 2022 at 20:41, you wrote:

thanks for providing this patch.

> Hello.
>
> Since we have a macro defined in our IRQ subsystem internal functions to
> traverse the list of actions, how about refactoring this loop?
>
> - genirq: Use a common macro to go through the actions list
> (f944b5a7aff05a244a6c8cac297819af09a199e4)
>
> have a good day!

Neither 'Hello' nor 'have a good day' are part of the change log.

Also please write the changelog in a factual way and not in form of a
question. If you want to add a reference to a git commit, then please
use the canonical form as described in Documentation/process, where you
also find the general patch submission rules. There is also a tip tree
specific chapter:

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html?highlight=x86#patch-submission-notes

Following these rules makes everyones life simpler.

> ---
>  kernel/irq/irqdesc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
> index 939d21cd55c3..34a0cefff712 100644
> --- a/kernel/irq/irqdesc.c
> +++ b/kernel/irq/irqdesc.c
> @@ -246,12 +246,12 @@ static ssize_t actions_show(struct kobject *kobj,
>  			    struct kobj_attribute *attr, char *buf)
>  {
>  	struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj);
> -	struct irqaction *action;
> +	struct irqaction *action = NULL;

There is no NULL initialization required.

Thanks,

        tglx

Resend Patch V2

๋ณด์™„ํ•œ ํŒจ์น˜๋ฅผ ๋‹ค์‹œ ๋ณด๋ƒ…๋‹ˆ๋‹ค.
์ถฉ๋ถ„ํ•˜๋‹ค๋ฉด ๋จธ์ง€ ์˜ˆ์ •์„ ์•Œ๋ ค์ฃผ๊ณ , ๋˜๋Š” ์ถ”๊ฐ€ ๋ณด์™„ ์‚ฌํ•ญ์„ ์•Œ๋ ค์ค๋‹ˆ๋‹ค.

Refactor for loop to macro for_each_action_of_desc

---
 kernel/irq/irqdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index d323b180b0f3..5db0230aa6b5 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -251,7 +251,7 @@ static ssize_t actions_show(struct kobject *kobj,
 	char *p = "";
 
 	raw_spin_lock_irq(&desc->lock);
-	for (action = desc->action; action != NULL; action = action->next) {
+	for_each_action_of_desc(desc, action) {
 		ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%s",
 				 p, action->name);
 		p = ",";

Linux Kernel - Check Patch Merge

๋ณด๋‚ธ ํŒจ์น˜๋Š” v6.0-rc1 ์—์„œ [GIT pull] irq/core for v6.0-rc1 - by Thomas Gleixner @ 2022-08-01 14:48 UTC [1%] ๋จธ์ง€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     c904cda04482d5ab545e5a82cee6084078ef9543
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/c904cda04482d5ab545e5a82cee6084078ef9543
AuthorDate:    Sun, 10 Jul 2022 20:26:14 +09:00
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Wed, 20 Jul 2022 15:21:32 +01:00

genirq: Use for_each_action_of_desc in actions_show()

Refactor action_show() to use for_each_action_of_desc instead
of a similar open-coded loop.

[maz: reword commit message]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220710112614.19410-1-p4ranlee@gmail.com
---
 kernel/irq/irqdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index d323b18..5db0230 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -251,7 +251,7 @@ static ssize_t actions_show(struct kobject *kobj,
 	char *p = "";
 
 	raw_spin_lock_irq(&desc->lock);
-	for (action = desc->action; action != NULL; action = action->next) {
+	for_each_action_of_desc(desc, action) {
 		ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%s",
 				 p, action->name);
 		p = ",";

๐Ÿค—

์ด์ƒ์ž…๋‹ˆ๋‹ค. ^^7 ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค!

Contribution - P.S.

๊ธฐ์–ต์— ๋‚จ๋Š” ๋ช‡ ๊ฐ€์ง€ ํŒจ์น˜ ํ•ญ๋ชฉ๋“ค์ž…๋‹ˆ๋‹ค.

  1. Xen Hypervisor ์•”๋ฌต์ ์ธ casting ์œผ๋กœ ์‹ค์ œ ์ฝ”๋“œ๊ฐ€ ๊ธธ์–ด์ง€๋Š” ํ˜„์ƒ
From: Julien Grall <julien@xen.org>

Well... I don't think the one less operation is because of introduction 
of the local variable (see more below).

> 
> (1) before clean up
> 
> 0000000000001bb4 <p2m_set_entry>:
>      while ( nr )
>      1bb4:       b40005e2        cbz     x2, 1c70 <p2m_set_entry+0xbc>
> {
>      ...
>          if ( rc )
>      1c1c:       350002e0        cbnz    w0, 1c78 <p2m_set_entry+0xc4>
>          sgfn = gfn_add(sgfn, (1 << order));

1 << order is a 32-bit value but the second parameter is a 64-bit value 
(assuming arm64). So...

>      1c20:       1ad32373        lsl     w19, w27, w19   // <<< CES works
>      1c24:       93407e73        sxtw    x19, w19        // <<< well!

... this instruction is extending the 32-bit value to 64-bit value.

>      return _gfn(gfn_x(gfn) + i);
>      1c28:       8b1302d6        add     x22, x22, x19
>      return _mfn(mfn_x(mfn) + i);
>      1c2c:       8b130281        add     x1, x20, x19
>      1c30:       b100069f        cmn     x20, #0x1
>      1c34:       9a941034        csel    x20, x1, x20, ne  // ne = any
>      while ( nr )
>      1c38:       eb1302b5        subs    x21, x21, x19
>      1c3c:       540001e0        b.eq    1c78 <p2m_set_entry+0xc4>  // b.none
> 
> (2) Using again mask variable. mask = 1UL << order
> code show me   sxtw    x19, w19    operation disappeared.
This code is not only using a local variable but also using "1UL". So, I 
suspect that if you were using 1 << order, the instruction would re-appear.

Cheers,
Julien Grall

Contribution - P.S.(Cont’d)

  1. Uftrace ํ•จ์ˆ˜๋ฅผ ๋›ฐ์–ด๋‹ค๋‹ˆ๋Š” ๋ถ„๊ธฐ(try-catch ๊ตฌํ˜„) longjmp() ๊ฐ€ ์ปดํŒŒ์ผ๋Ÿฌ ์ตœ์ ํ™”๋กœ ๋™์ž‘์„ ์•ˆํ•˜๋Š” ํ˜„์ƒ
diff --git a/tests/s-longjmp.c b/tests/s-longjmp.c
index 487e9264..64fc7c38 100644
--- a/tests/s-longjmp.c
+++ b/tests/s-longjmp.c
@@ -8,6 +8,9 @@ int foo(void)
        return 0;
 }

+#if __clang__
+__attribute__((optnone))
+#endif
 int bar(void)
 {
        return -1;

Another solution is to make bar function has more contents
so that it can't be optimized in clang.

๐Ÿค—

์ง„์งœ ๋ ๐Ÿค—