public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	david@redhat.com, thuth@redhat.com, seiden@linux.ibm.com,
	nrb@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH 1/5] s390x: Add a linker script to assembly snippets
Date: Thu, 24 Nov 2022 15:28:48 +0100	[thread overview]
Message-ID: <4354acda-f809-4c83-55c7-6407640cbdd2@linux.ibm.com> (raw)
In-Reply-To: <20221123134523.5af2b5ab@p-imbrenda>

On 11/23/22 13:45, Claudio Imbrenda wrote:
> On Wed, 23 Nov 2022 08:46:52 +0000
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> A linker script has a few benefits:
>> - Random data doesn't end up in the binary breaking tests
>> - We can easily define a lowcore and load the snippet from 0x0 instead
>> of 0x4000 which makes asm snippets behave like c snippets
>> - We can easily define an invalid PGM new PSW to ensure an exit on a
>> guest PGM
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> 
> looks good in general, but I have a few questions
> 
>> ---
>>   lib/s390x/snippet.h         |  3 +--
>>   s390x/Makefile              |  5 +++--
>>   s390x/mvpg-sie.c            |  2 +-
>>   s390x/pv-diags.c            |  6 +++---
>>   s390x/snippets/asm/flat.lds | 43 +++++++++++++++++++++++++++++++++++++
>>   5 files changed, 51 insertions(+), 8 deletions(-)
>>   create mode 100644 s390x/snippets/asm/flat.lds
>>
>> diff --git a/lib/s390x/snippet.h b/lib/s390x/snippet.h
>> index b17b2a4c..57045994 100644
>> --- a/lib/s390x/snippet.h
>> +++ b/lib/s390x/snippet.h
>> @@ -32,8 +32,7 @@
>>   
>>   #define SNIPPET_PV_TWEAK0	0x42UL
>>   #define SNIPPET_PV_TWEAK1	0UL
>> -#define SNIPPET_OFF_C		0
>> -#define SNIPPET_OFF_ASM		0x4000
>> +#define SNIPPET_UNPACK_OFF	0
>>   
>>   
>>   /*
>> diff --git a/s390x/Makefile b/s390x/Makefile
>> index bf1504f9..bb0f9eb8 100644
>> --- a/s390x/Makefile
>> +++ b/s390x/Makefile
>> @@ -135,7 +135,8 @@ $(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets)
>>   	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
>>   
>>   $(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o
>> -	$(OBJCOPY) -O binary -j ".rodata" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $(patsubst %.gbin,%.o,$@) $@
>> +	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $(patsubst %.gbin,%.o,$@)
> 
> I think you can simply use $< instead of the patsubst expression

Right, I'll fix that momentarily.

[...]

>> +	.text : {
>> +		*(.text)
>> +		*(.text.*)
>> +	}
>> +	. = ALIGN(64K);
> 
> any reason to align to 64k? (instead of e.g. 4k)

Well, I've copied that from s390x/flat.lds...
I'll have a look at the required alignments when I find time.

> 
>> +	etext = .;
>> +	. = ALIGN(16);
> 
> do you need the ALIGN? I would think we are already aligned here
> 
>> +	.data : {
>> +		*(.data)
>> +		*(.data.rel*)
>> +	}
>> +	. = ALIGN(16);
>> +	.rodata : { *(.rodata) *(.rodata.*) }
>> +	. = ALIGN(16);
>> +	__bss_start = .;
>> +	.bss : { *(.bss) }
>> +	__bss_end = .;
>> +	. = ALIGN(64K);
> 
> same question as above regarding 64k
> 
>> +}
> 


  reply	other threads:[~2022-11-24 14:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  8:46 [kvm-unit-tests PATCH 0/5] s390x: Snippet fixes Janosch Frank
2022-11-23  8:46 ` [kvm-unit-tests PATCH 1/5] s390x: Add a linker script to assembly snippets Janosch Frank
2022-11-23 12:45   ` Claudio Imbrenda
2022-11-24 14:28     ` Janosch Frank [this message]
2022-11-24 20:42   ` Janis Schoetterl-Glausch
2022-11-25 10:07     ` Janosch Frank
2022-11-23  8:46 ` [kvm-unit-tests PATCH 2/5] s390x: snippets: Fix SET_PSW_NEW_ADDR macro Janosch Frank
2022-11-23 10:58   ` Nico Boehr
2022-11-23 13:05   ` Claudio Imbrenda
2022-11-23  8:46 ` [kvm-unit-tests PATCH 3/5] lib: s390x: sie: Set guest memory pointer Janosch Frank
2022-11-23 11:01   ` Nico Boehr
2022-11-23 12:46   ` Claudio Imbrenda
2022-11-23  8:46 ` [kvm-unit-tests PATCH 4/5] s390x: Clear first stack frame and end backtrace early Janosch Frank
2022-11-23 11:05   ` Nico Boehr
2022-11-23 12:47   ` Claudio Imbrenda
2022-11-23  8:46 ` [kvm-unit-tests PATCH 5/5] lib: s390x: Handle debug prints for SIE exceptions correctly Janosch Frank
2022-11-23 13:01   ` Claudio Imbrenda
2022-11-30 14:38     ` Janosch Frank
2022-11-30 14:46       ` Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4354acda-f809-4c83-55c7-6407640cbdd2@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox